﻿Imports Microsoft.VisualBasic
Imports System.Xml
Imports System.IO

Public Class clsAmloXMLShort
    Private clsDateFormat As clsDateFormat

    Public Function AddAMLO1node(ByVal filePath As String, ByVal pAmlo1Data As clsAmlo1Data, ByVal pCountPsn As Integer, ByVal pAmlo1Psn() As clsAmlo1Psn, ByVal intLoop As Integer, ByVal intMaxLoop As Integer) As Boolean
        Try
            Dim i As Integer
            Dim xmldoc As XmlDocument
            xmldoc = New XmlDocument()
            xmldoc.Load(filePath)
            Dim parentNode As XmlElement
            parentNode = xmldoc.CreateElement("doc")
            Dim a0_version As XmlElement
            Dim a0_org As XmlElement
            Dim xmla0_version As XmlText
            Dim xmla0_org As XmlText
            clsDateFormat = New clsDateFormat

            If Not (IsDBNull(xmldoc.DocumentElement)) Then
                xmldoc.DocumentElement.PrependChild(parentNode)
                If (intLoop = intMaxLoop) Then
                    a0_org = xmldoc.CreateElement("org")
                    a0_version = xmldoc.CreateElement("version")

                    xmla0_org = xmldoc.CreateTextNode("ธนาคารอาคารสงเคราะห์")
                    xmla0_version = xmldoc.CreateTextNode("1.1")

                    xmldoc.DocumentElement.PrependChild(a0_org)
                    xmldoc.DocumentElement.PrependChild(a0_version)

                    a0_org.AppendChild(xmla0_org)
                    a0_version.AppendChild(xmla0_version)

                End If

            End If

            ' Create the required nodes 

            Dim a1_type As XmlElement
            Dim a1_reportid As XmlElement
            'Dim a1_revision As XmlElement
            Dim a1_date As XmlElement
            'cnd==========Begin==================
            Dim a1_cnd As XmlElement
            'name-------------------
            Dim a1_cnd_name As XmlElement
            'Dim a1_cnd_name_prefix As XmlElement
            Dim a1_cnd_name_first As XmlElement
            'Dim a1_cnd_name_middle As XmlElement
            Dim a1_cnd_name_last As XmlElement
            'id------------------------
            Dim a1_cnd_id As XmlElement
            Dim a1_cnd_id_no As XmlElement
            Dim a1_cnd_id_type As XmlElement
            'location-----------------
            Dim a1_cnd_location As XmlElement
            'Dim a1_cnd_location_addr As XmlElement
            Dim a1_cnd_location_phone As XmlElement
            'Dim a1_cnd_location_fax As XmlElement
            'office-----------------
            Dim a1_cnd_office As XmlElement
            Dim a1_cnd_office_occ As XmlElement
            'Dim a1_cnd_office_desc As XmlElement
            Dim a1_cnd_office_org As XmlElement
            Dim a1_cnd_office_phone As XmlElement
            Dim a1_cnd_office_fax As XmlElement
            'contact----------------
            Dim a1_cnd_contact As XmlElement
            'Dim a1_cnd_contact_addr As XmlElement
            Dim a1_cnd_contact_phone As XmlElement
            'Dim a1_cnd_contact_fax As XmlElement
            'iddoc----------------
            'Dim a1_cnd_iddoc As XmlElement
            'Dim a1_cnd_iddoc_type As XmlElement
            'Dim a1_cnd_iddoc_desc As XmlElement
            'Dim a1_cnd_iddoc_no As XmlElement
            'Dim a1_cnd_iddoc_by As XmlElement
            'Dim a1_cnd_iddoc_date As XmlElement
            'Dim a1_cnd_iddoc_expire As XmlElement
            'cnd==========End==================
            'psn==========Begin==================
            Dim a1_psn(pCountPsn) As XmlElement
            Dim a1_psn_relation(pCountPsn) As XmlElement
            'name-------------------
            Dim a1_psn_name(pCountPsn) As XmlElement
            'Dim a1_psn_name_prefix(pCountPsn) As XmlElement
            Dim a1_psn_name_first(pCountPsn) As XmlElement
            'Dim a1_psn_name_middle(pCountPsn) As XmlElement
            Dim a1_psn_name_last(pCountPsn) As XmlElement
            'id------------------------
            Dim a1_psn_id(pCountPsn) As XmlElement
            Dim a1_psn_id_no(pCountPsn) As XmlElement
            Dim a1_psn_id_type(pCountPsn) As XmlElement
            'location-----------------
            Dim a1_psn_location(pCountPsn) As XmlElement
            'Dim a1_psn_location_addr(pCountPsn) As XmlElement
            Dim a1_psn_location_phone(pCountPsn) As XmlElement
            'Dim a1_psn_location_fax(pCountPsn) As XmlElement
            'office-----------------
            Dim a1_psn_office(pCountPsn) As XmlElement
            Dim a1_psn_office_occ(pCountPsn) As XmlElement
            Dim a1_psn_office_org(pCountPsn) As XmlElement
            Dim a1_psn_office_phone(pCountPsn) As XmlElement
            Dim a1_psn_office_fax(pCountPsn) As XmlElement
            Dim a1_psn_office_type(pCountPsn) As XmlElement
            'Dim a1_psn_office_desc(pCountPsn) As XmlElement
            'contact----------------
            Dim a1_psn_contact(pCountPsn) As XmlElement
            'Dim a1_psn_contact_addr(pCountPsn) As XmlElement
            Dim a1_psn_contact_phone(pCountPsn) As XmlElement
            'Dim a1_psn_contact_fax(pCountPsn) As XmlElement
            'iddoc----------------
            'Dim a1_psn_iddoc(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_type(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_desc(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_no(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_by(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_date(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_expire(pCountPsn) As XmlElement
            'psn==========End==================

            'tsc==========Begin==================
            Dim a1_tsc As XmlElement
            Dim a1_tsc_date As XmlElement
            'contact----------------
            Dim a1_tsc_item As XmlElement
            Dim a1_tsc_item_type As XmlElement
            'Dim a1_tsc_item_desc As XmlElement
            Dim a1_tsc_item_accno As XmlElement
            'Dim a1_tsc_item_cur As XmlElement
            Dim a1_tsc_item_amt As XmlElement
            'name-------------------
            Dim a1_tsc_name As XmlElement
            'Dim a1_tsc_name_prefix As XmlElement
            Dim a1_tsc_name_first As XmlElement
            'Dim a1_tsc_name_middle As XmlElement
            Dim a1_tsc_name_last As XmlElement
            'obj----------------
            Dim a1_tsc_obj As XmlElement
            Dim a1_tsc_obj_type As XmlElement
            'Dim a1_tsc_obj_desc As XmlElement
            'tsc==========End==================
            'record==========Begin==================
            Dim a1_record As XmlElement
            Dim a1_record_writer As XmlElement
            Dim a1_record_sign As XmlElement
            Dim a1_record_date As XmlElement
            'record==========End==================



            a1_type = xmldoc.CreateElement("type")
            a1_reportid = xmldoc.CreateElement("reportid")
            'a1_revision = xmldoc.CreateElement("revision")
            a1_date = xmldoc.CreateElement("date")
            'cnd==========Begin==================
            a1_cnd = xmldoc.CreateElement("cnd")
            'name-------------------
            a1_cnd_name = xmldoc.CreateElement("name")
            'a1_cnd_name_prefix = xmldoc.CreateElement("prefix")
            a1_cnd_name_first = xmldoc.CreateElement("first")
            'a1_cnd_name_middle = xmldoc.CreateElement("middle")
            a1_cnd_name_last = xmldoc.CreateElement("last")
            'id------------------------
            a1_cnd_id = xmldoc.CreateElement("id")
            a1_cnd_id_no = xmldoc.CreateElement("no")
            a1_cnd_id_type = xmldoc.CreateElement("type")
            'location-----------------
            a1_cnd_location = xmldoc.CreateElement("location")
            'a1_cnd_location_addr = xmldoc.CreateElement("addr")
            a1_cnd_location_phone = xmldoc.CreateElement("phone")
            'a1_cnd_location_fax = xmldoc.CreateElement("fax")
            'office-----------------
            a1_cnd_office = xmldoc.CreateElement("office")
            a1_cnd_office_occ = xmldoc.CreateElement("occ")
            'a1_cnd_office_desc = xmldoc.CreateElement("desc")
            a1_cnd_office_org = xmldoc.CreateElement("org")
            a1_cnd_office_phone = xmldoc.CreateElement("phone")
            a1_cnd_office_fax = xmldoc.CreateElement("fax")
            'contact----------------
            a1_cnd_contact = xmldoc.CreateElement("contact")
            'a1_cnd_contact_addr = xmldoc.CreateElement("addr")
            a1_cnd_contact_phone = xmldoc.CreateElement("phone")
            'a1_cnd_contact_fax = xmldoc.CreateElement("fax")
            'iddoc----------------

            'a1_cnd_iddoc = xmldoc.CreateElement("iddoc")
            'a1_cnd_iddoc_type = xmldoc.CreateElement("type")
            'a1_cnd_iddoc_desc = xmldoc.CreateElement("desc")
            'a1_cnd_iddoc_no = xmldoc.CreateElement("no")
            'a1_cnd_iddoc_by = xmldoc.CreateElement("by")
            'a1_cnd_iddoc_date = xmldoc.CreateElement("date")
            'a1_cnd_iddoc_expire = xmldoc.CreateElement("expire")
            'cnd==========End==================

            For i = 1 To pCountPsn
                'psn==========Begin==================
                a1_psn(i) = xmldoc.CreateElement("psn")
                a1_psn_relation(i) = xmldoc.CreateElement("relation")
                'name-------------------
                a1_psn_name(i) = xmldoc.CreateElement("name")
                'a1_psn_name_prefix(i) = xmldoc.CreateElement("prefix")
                a1_psn_name_first(i) = xmldoc.CreateElement("first")
                'a1_psn_name_middle(i) = xmldoc.CreateElement("middle")
                a1_psn_name_last(i) = xmldoc.CreateElement("last")
                'id------------------------
                a1_psn_id(i) = xmldoc.CreateElement("id")
                a1_psn_id_no(i) = xmldoc.CreateElement("no")
                a1_psn_id_type(i) = xmldoc.CreateElement("type")
                'location-----------------
                a1_psn_location(i) = xmldoc.CreateElement("location")
                'a1_psn_location_addr(i) = xmldoc.CreateElement("addr")
                a1_psn_location_phone(i) = xmldoc.CreateElement("phone")
                'a1_psn_location_fax(i) = xmldoc.CreateElement("fax")
                'office-----------------
                a1_psn_office(i) = xmldoc.CreateElement("office")
                a1_psn_office_occ(i) = xmldoc.CreateElement("occ")
                a1_psn_office_org(i) = xmldoc.CreateElement("org")
                a1_psn_office_phone(i) = xmldoc.CreateElement("phone")
                a1_psn_office_fax(i) = xmldoc.CreateElement("fax")
                a1_psn_office_type(i) = xmldoc.CreateElement("type")
                'a1_psn_office_desc(i) = xmldoc.CreateElement("desc")
                'contact----------------
                a1_psn_contact(i) = xmldoc.CreateElement("contact")
                'a1_psn_contact_addr(i) = xmldoc.CreateElement("addr")
                a1_psn_contact_phone(i) = xmldoc.CreateElement("phone")
                'a1_psn_contact_fax(i) = xmldoc.CreateElement("fax")
                'iddoc----------------
                'a1_psn_iddoc(i) = xmldoc.CreateElement("iddoc")
                'a1_psn_iddoc_type(i) = xmldoc.CreateElement("type")
                'a1_psn_iddoc_desc(i) = xmldoc.CreateElement("desc")
                'a1_psn_iddoc_no(i) = xmldoc.CreateElement("no")
                'a1_psn_iddoc_by(i) = xmldoc.CreateElement("by")
                'a1_psn_iddoc_date(i) = xmldoc.CreateElement("date")
                'a1_psn_iddoc_expire(i) = xmldoc.CreateElement("expire")
                'psn==========End==================
            Next


            'tsc==========Begin==================
            a1_tsc = xmldoc.CreateElement("tsc")
            a1_tsc_date = xmldoc.CreateElement("date")
            'contact----------------
            a1_tsc_item = xmldoc.CreateElement("item")
            a1_tsc_item_type = xmldoc.CreateElement("type")
            'a1_tsc_item_desc = xmldoc.CreateElement("desc")
            a1_tsc_item_accno = xmldoc.CreateElement("accno")
            'a1_tsc_item_cur = xmldoc.CreateElement("cur")
            a1_tsc_item_amt = xmldoc.CreateElement("amt")
            'name-------------------
            a1_tsc_name = xmldoc.CreateElement("name")
            'a1_tsc_name_prefix = xmldoc.CreateElement("prefix")
            a1_tsc_name_first = xmldoc.CreateElement("first")
            'a1_tsc_name_middle = xmldoc.CreateElement("middle")
            a1_tsc_name_last = xmldoc.CreateElement("last")
            'obj----------------
            a1_tsc_obj = xmldoc.CreateElement("obj")
            a1_tsc_obj_type = xmldoc.CreateElement("type")
            'a1_tsc_obj_desc = xmldoc.CreateElement("desc")
            'tsc==========End==================
            'record==========Begin==================
            a1_record = xmldoc.CreateElement("record")
            a1_record_writer = xmldoc.CreateElement("writer")
            a1_record_sign = xmldoc.CreateElement("sign")
            a1_record_date = xmldoc.CreateElement("date")
            'record==========End==================

            Dim xmla1_type As XmlText
            Dim xmla1_reportid As XmlText
            'Dim xmla1_revision As XmlText
            Dim xmla1_date As XmlText
            'cnd==========Begin==================
            ' Dim xmla1_cnd As XmlText
            'name-------------------
            'Dim xmla1_cnd_name As XmlText
            'Dim xmla1_cnd_name_prefix As XmlText
            Dim xmla1_cnd_name_first As XmlText
            'Dim xmla1_cnd_name_middle As XmlText
            Dim xmla1_cnd_name_last As XmlText
            'id------------------------
            'Dim xmla1_cnd_id As XmlText
            Dim xmla1_cnd_id_no As XmlText
            Dim xmla1_cnd_id_type As XmlText
            'location-----------------
            'Dim xmla1_cnd_location As XmlText
            'Dim xmla1_cnd_location_addr As XmlText
            Dim xmla1_cnd_location_phone As XmlText
            'Dim xmla1_cnd_location_fax As XmlText
            'office-----------------
            'Dim xmla1_cnd_office As XmlText
            Dim xmla1_cnd_office_occ As XmlText
            'Dim xmla1_cnd_office_desc As XmlText
            Dim xmla1_cnd_office_org As XmlText
            Dim xmla1_cnd_office_phone As XmlText
            Dim xmla1_cnd_office_fax As XmlText
            'contact----------------
            'Dim xmla1_cnd_contact As XmlText
            'Dim xmla1_cnd_contact_addr As XmlText
            Dim xmla1_cnd_contact_phone As XmlText
            'Dim xmla1_cnd_contact_fax As XmlText
            'iddoc----------------
            'Dim xmla1_cnd_iddoc As XmlText
            'Dim xmla1_cnd_iddoc_type As XmlText
            'Dim xmla1_cnd_iddoc_desc As XmlText
            'Dim xmla1_cnd_iddoc_no As XmlText
            'Dim xmla1_cnd_iddoc_by As XmlText
            'Dim xmla1_cnd_iddoc_date As XmlText
            'Dim xmla1_cnd_iddoc_expire As XmlText
            'cnd==========End==================
            'psn==========Begin==================
            'Dim xmla1_psn As XmlText
            Dim xmla1_psn_relation(pCountPsn) As XmlText
            'name-------------------
            'Dim xmla1_psn_name As XmlText
            'Dim xmla1_psn_name_prefix(pCountPsn) As XmlText
            Dim xmla1_psn_name_first(pCountPsn) As XmlText
            'Dim xmla1_psn_name_middle(pCountPsn) As XmlText
            Dim xmla1_psn_name_last(pCountPsn) As XmlText
            'id------------------------
            'Dim xmla1_psn_id As XmlText
            Dim xmla1_psn_id_no(pCountPsn) As XmlText
            Dim xmla1_psn_id_type(pCountPsn) As XmlText
            'location-----------------
            'Dim xmla1_psn_location As XmlText
            'Dim xmla1_psn_location_addr(pCountPsn) As XmlText
            Dim xmla1_psn_location_phone(pCountPsn) As XmlText
            'Dim xmla1_psn_location_fax(pCountPsn) As XmlText
            'office-----------------
            'Dim xmla1_psn_office As XmlText
            Dim xmla1_psn_office_occ(pCountPsn) As XmlText
            Dim xmla1_psn_office_org(pCountPsn) As XmlText
            Dim xmla1_psn_office_phone(pCountPsn) As XmlText
            Dim xmla1_psn_office_fax(pCountPsn) As XmlText
            Dim xmla1_psn_office_type(pCountPsn) As XmlText
            'Dim xmla1_psn_office_desc(pCountPsn) As XmlText
            'contact----------------
            'Dim xmla1_psn_contact As XmlText
            'Dim xmla1_psn_contact_addr(pCountPsn) As XmlText
            Dim xmla1_psn_contact_phone(pCountPsn) As XmlText
            'Dim xmla1_psn_contact_fax(pCountPsn) As XmlText
            'iddoc----------------
            'Dim xmla1_psn_iddoc As XmlText
            'Dim xmla1_psn_iddoc_type(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_desc(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_no(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_by(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_date(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_expire(pCountPsn) As XmlText
            'psn==========End==================

            'tsc==========Begin==================
            'Dim xmla1_tsc As XmlText
            Dim xmla1_tsc_date As XmlText
            'contact----------------
            'Dim xmla1_tsc_item As XmlText
            Dim xmla1_tsc_item_type As XmlText
            'Dim xmla1_tsc_item_desc As XmlText
            Dim xmla1_tsc_item_accno As XmlText
            'Dim xmla1_tsc_item_cur As XmlText
            Dim xmla1_tsc_item_amt As XmlText
            'name-------------------
            'Dim xmla1_tsc_name As XmlText
            'Dim xmla1_tsc_name_prefix As XmlText
            Dim xmla1_tsc_name_first As XmlText
            'Dim xmla1_tsc_name_middle As XmlText
            Dim xmla1_tsc_name_last As XmlText
            'obj----------------
            'Dim xmla1_tsc_obj As XmlText
            Dim xmla1_tsc_obj_type As XmlText
            'Dim xmla1_tsc_obj_desc As XmlText
            'tsc==========End==================
            'record==========Begin==================
            'Dim xmla1_record As XmlText
            Dim xmla1_record_writer As XmlText
            Dim xmla1_record_sign As XmlText
            Dim xmla1_record_date As XmlText
            'record==========End==================

            xmla1_type = xmldoc.CreateTextNode(pAmlo1Data.p01_type)
            xmla1_reportid = xmldoc.CreateTextNode(pAmlo1Data.p02_reportid)
            'xmla1_revision = xmldoc.CreateTextNode(pAmlo1Data.p03_revision)
            xmla1_date = xmldoc.CreateTextNode(pAmlo1Data.p04_date)
            'cnd==========Begin================== 
            'name------------------- 
            'xmla1_cnd_name_prefix = xmldoc.CreateTextNode(pAmlo1Data.p101_cnd_name_prefix)
            xmla1_cnd_name_first = xmldoc.CreateTextNode(pAmlo1Data.p102_cnd_name_first)
            'xmla1_cnd_name_middle = xmldoc.CreateTextNode(pAmlo1Data.p103_cnd_name_middle)
            xmla1_cnd_name_last = xmldoc.CreateTextNode(pAmlo1Data.p104_cnd_name_last)
            'id------------------------ 
            xmla1_cnd_id_no = xmldoc.CreateTextNode(pAmlo1Data.p105_cnd_id_no)
            xmla1_cnd_id_type = xmldoc.CreateTextNode(pAmlo1Data.p106_cnd_id_type)
            'location----------------- 
            'xmla1_cnd_location_addr = xmldoc.CreateTextNode(pAmlo1Data.p107_cnd_location_addr)
            xmla1_cnd_location_phone = xmldoc.CreateTextNode(pAmlo1Data.p108_cnd_location_phone)
            'xmla1_cnd_location_fax = xmldoc.CreateTextNode(pAmlo1Data.p109_cnd_location_fax)
            'office----------------- 
            xmla1_cnd_office_occ = xmldoc.CreateTextNode(pAmlo1Data.p110_cnd_office_occ)
            'xmla1_cnd_office_desc = xmldoc.CreateTextNode(pAmlo1Data.p111_cnd_office_desc)
            xmla1_cnd_office_org = xmldoc.CreateTextNode(pAmlo1Data.p112_cnd_office_org)
            xmla1_cnd_office_phone = xmldoc.CreateTextNode(pAmlo1Data.p113_cnd_office_phone)
            xmla1_cnd_office_fax = xmldoc.CreateTextNode(pAmlo1Data.p114_cnd_office_fax)
            'contact---------------- 
            'xmla1_cnd_contact_addr = xmldoc.CreateTextNode(pAmlo1Data.p115_cnd_contact_addr)
            xmla1_cnd_contact_phone = xmldoc.CreateTextNode(pAmlo1Data.p116_cnd_contact_phone)
            'xmla1_cnd_contact_fax = xmldoc.CreateTextNode(pAmlo1Data.p117_cnd_contact_fax)
            'iddoc---------------- 
            'xmla1_cnd_iddoc_type = xmldoc.CreateTextNode(pAmlo1Data.p118_cnd_iddoc_type)
            'xmla1_cnd_iddoc_desc = xmldoc.CreateTextNode(pAmlo1Data.p119_cnd_iddoc_desc)
            'xmla1_cnd_iddoc_no = xmldoc.CreateTextNode(pAmlo1Data.p120_cnd_iddoc_no)
            'xmla1_cnd_iddoc_by = xmldoc.CreateTextNode(pAmlo1Data.p121_cnd_iddoc_by)
            'xmla1_cnd_iddoc_date = xmldoc.CreateTextNode(pAmlo1Data.p122_cnd_iddoc_date)
            'xmla1_cnd_iddoc_expire = xmldoc.CreateTextNode(pAmlo1Data.p123_cnd_iddoc_expire)
            'cnd==========End==================
            For i = 1 To pCountPsn
                'psn==========Begin================== 
                xmla1_psn_relation(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p201_psn_relation)
                'name------------------- 
                'xmla1_psn_name_prefix(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p202_psn_name_prefix)
                xmla1_psn_name_first(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p203_psn_name_first)
                'xmla1_psn_name_middle(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p204_psn_name_middle)
                xmla1_psn_name_last(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p205_psn_name_last)
                'id------------------------ 
                xmla1_psn_id_no(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p206_psn_id_no)
                xmla1_psn_id_type(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p207_psn_id_type)
                'location----------------- 
                'xmla1_psn_location_addr(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p208_psn_location_addr)
                xmla1_psn_location_phone(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p209_psn_location_phone)
                'xmla1_psn_location_fax(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p210_psn_location_fax)
                'office----------------- 
                xmla1_psn_office_occ(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p211_psn_office_occ)
                xmla1_psn_office_org(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p212_psn_office_org)
                xmla1_psn_office_phone(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p213_psn_office_phone)
                xmla1_psn_office_fax(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p214_psn_office_fax)
                xmla1_psn_office_type(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p215_psn_office_type)
                'xmla1_psn_office_desc(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p216_psn_office_desc)
                'contact---------------- 
                'xmla1_psn_contact_addr(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p217_psn_contact_addr)
                xmla1_psn_contact_phone(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p218_psn_contact_phone)
                'xmla1_psn_contact_fax(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p219_psn_contact_fax)
                'iddoc---------------- 
                'xmla1_psn_iddoc_type(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p220_psn_iddoc_type)
                'xmla1_psn_iddoc_desc(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p221_psn_iddoc_desc)
                'xmla1_psn_iddoc_no(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p222_psn_iddoc_no)
                'xmla1_psn_iddoc_by(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p223_psn_iddoc_by)
                'xmla1_psn_iddoc_date(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p224_psn_iddoc_date)
                'xmla1_psn_iddoc_expire(i) = xmldoc.CreateTextNode(pAmlo1Psn(i).p225_psn_iddoc_expire)
                'psn==========End==================
            Next i
            'tsc==========Begin================== 
            xmla1_tsc_date = xmldoc.CreateTextNode(pAmlo1Data.p301_tsc_date)
            'contact---------------- 
            xmla1_tsc_item_type = xmldoc.CreateTextNode(pAmlo1Data.p302_tsc_item_type)
            'xmla1_tsc_item_desc = xmldoc.CreateTextNode(pAmlo1Data.p303_tsc_item_desc)
            xmla1_tsc_item_accno = xmldoc.CreateTextNode(pAmlo1Data.p304_tsc_item_acccno)
            'xmla1_tsc_item_cur = xmldoc.CreateTextNode(pAmlo1Data.p305_tsc_item_cur)
            xmla1_tsc_item_amt = xmldoc.CreateTextNode(pAmlo1Data.p306_tsc_item_amt)
            'name------------------- 
            'xmla1_tsc_name_prefix = xmldoc.CreateTextNode(pAmlo1Data.p307_tsc_name_prefix)
            xmla1_tsc_name_first = xmldoc.CreateTextNode(pAmlo1Data.p308_tsc_name_first)
            'xmla1_tsc_name_middle = xmldoc.CreateTextNode(pAmlo1Data.p309_tsc_name_middle)
            xmla1_tsc_name_last = xmldoc.CreateTextNode(pAmlo1Data.p310_tsc_name_last)
            'obj---------------- 
            xmla1_tsc_obj_type = xmldoc.CreateTextNode(pAmlo1Data.p311_tsc_obj_type)
            'xmla1_tsc_obj_desc = xmldoc.CreateTextNode(pAmlo1Data.p312_tsc_obj_desc)
            'tsc==========End==================
            'record==========Begin================== 
            xmla1_record_writer = xmldoc.CreateTextNode(pAmlo1Data.p401_record_writer)
            xmla1_record_sign = xmldoc.CreateTextNode(pAmlo1Data.p402_record_sign)
            xmla1_record_date = xmldoc.CreateTextNode(pAmlo1Data.p403_record_date)
            'record==========End==================

            '// append the nodes to the parentNode without the value
            parentNode.AppendChild(a1_type)
            parentNode.AppendChild(a1_reportid)
            'parentNode.AppendChild(a1_revision)
            parentNode.AppendChild(a1_date)
            'cnd==========Begin==================
            parentNode.AppendChild(a1_cnd)
            'name-------------------
            a1_cnd.AppendChild(a1_cnd_name)
            'a1_cnd_name.AppendChild(a1_cnd_name_prefix)
            a1_cnd_name.AppendChild(a1_cnd_name_first)
            'a1_cnd_name.AppendChild(a1_cnd_name_middle)
            a1_cnd_name.AppendChild(a1_cnd_name_last)
            'id------------------------
            a1_cnd.AppendChild(a1_cnd_id)
            a1_cnd_id.AppendChild(a1_cnd_id_no)
            a1_cnd_id.AppendChild(a1_cnd_id_type)
            'location-----------------
            a1_cnd.AppendChild(a1_cnd_location)
            'a1_cnd_location.AppendChild(a1_cnd_location_addr)
            a1_cnd_location.AppendChild(a1_cnd_location_phone)
            'a1_cnd_location.AppendChild(a1_cnd_location_fax)
            'office-----------------
            a1_cnd.AppendChild(a1_cnd_office)
            a1_cnd_office.AppendChild(a1_cnd_office_occ)
            'a1_cnd_office.AppendChild(a1_cnd_office_desc)
            a1_cnd_office.AppendChild(a1_cnd_office_org)
            a1_cnd_office.AppendChild(a1_cnd_office_phone)
            a1_cnd_office.AppendChild(a1_cnd_office_fax)
            'contact----------------
            a1_cnd.AppendChild(a1_cnd_contact)
            'a1_cnd_contact.AppendChild(a1_cnd_contact_addr)
            a1_cnd_contact.AppendChild(a1_cnd_contact_phone)
            'a1_cnd_contact.AppendChild(a1_cnd_contact_fax)
            'iddoc----------------
            'a1_cnd.AppendChild(a1_cnd_iddoc)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_type)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_desc)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_no)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_by)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_date)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_expire)
            'cnd==========End==================
            For i = 1 To pCountPsn
                'psn==========Begin==================
                parentNode.AppendChild(a1_psn(i))
                a1_psn(i).AppendChild(a1_psn_relation(i))
                'name-------------------
                a1_psn(i).AppendChild(a1_psn_name(i))
                'a1_psn_name(i).AppendChild(a1_psn_name_prefix(i))
                a1_psn_name(i).AppendChild(a1_psn_name_first(i))
                'a1_psn_name(i).AppendChild(a1_psn_name_middle(i))
                a1_psn_name(i).AppendChild(a1_psn_name_last(i))
                'id------------------------
                a1_psn(i).AppendChild(a1_psn_id(i))
                a1_psn_id(i).AppendChild(a1_psn_id_no(i))
                a1_psn_id(i).AppendChild(a1_psn_id_type(i))
                'location-----------------
                a1_psn(i).AppendChild(a1_psn_location(i))
                'a1_psn_location(i).AppendChild(a1_psn_location_addr(i))
                a1_psn_location(i).AppendChild(a1_psn_location_phone(i))
                'a1_psn_location(i).AppendChild(a1_psn_location_fax(i))
                'office-----------------
                a1_psn(i).AppendChild(a1_psn_office(i))
                a1_psn_office(i).AppendChild(a1_psn_office_occ(i))
                a1_psn_office(i).AppendChild(a1_psn_office_org(i))
                a1_psn_office(i).AppendChild(a1_psn_office_phone(i))
                a1_psn_office(i).AppendChild(a1_psn_office_fax(i))
                a1_psn_office(i).AppendChild(a1_psn_office_type(i))
                'a1_psn_office(i).AppendChild(a1_psn_office_desc(i))
                'contact----------------
                a1_psn(i).AppendChild(a1_psn_contact(i))
                'a1_psn_contact(i).AppendChild(a1_psn_contact_addr(i))
                a1_psn_contact(i).AppendChild(a1_psn_contact_phone(i))
                'a1_psn_contact(i).AppendChild(a1_psn_contact_fax(i))
                'iddoc----------------
                'a1_psn(i).AppendChild(a1_psn_iddoc(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_type(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_desc(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_no(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_by(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_date(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_expire(i))
                'psn==========End==================

            Next

            'tsc==========Begin==================
            parentNode.AppendChild(a1_tsc)
            a1_tsc.AppendChild(a1_tsc_date)
            'contact----------------
            a1_tsc.AppendChild(a1_tsc_item)
            a1_tsc_item.AppendChild(a1_tsc_item_type)
            'a1_tsc_item.AppendChild(a1_tsc_item_desc)
            a1_tsc_item.AppendChild(a1_tsc_item_accno)
            'a1_tsc_item.AppendChild(a1_tsc_item_cur)
            a1_tsc_item.AppendChild(a1_tsc_item_amt)
            'name-------------------
            a1_tsc.AppendChild(a1_tsc_name)
            'a1_tsc_name.AppendChild(a1_tsc_name_prefix)
            a1_tsc_name.AppendChild(a1_tsc_name_first)
            'a1_tsc_name.AppendChild(a1_tsc_name_middle)
            a1_tsc_name.AppendChild(a1_tsc_name_last)
            'obj----------------
            a1_tsc.AppendChild(a1_tsc_obj)
            a1_tsc_obj.AppendChild(a1_tsc_obj_type)
            'a1_tsc_obj.AppendChild(a1_tsc_obj_desc)
            'tsc==========End==================
            'record==========Begin==================
            parentNode.AppendChild(a1_record)
            a1_record.AppendChild(a1_record_writer)
            a1_record.AppendChild(a1_record_sign)
            a1_record.AppendChild(a1_record_date)
            'record==========End==================

            '// save the value of the fields into the nodes 
            a1_type.AppendChild(xmla1_type)
            a1_reportid.AppendChild(xmla1_reportid)
            'a1_revision.AppendChild(xmla1_revision)
            a1_date.AppendChild(xmla1_date)
            'cnd==========Begin================== 
            'name-------------------
            'a1_cnd_name.AppendChild(xmla1_cnd_name)
            'a1_cnd_name_prefix.AppendChild(xmla1_cnd_name_prefix)
            a1_cnd_name_first.AppendChild(xmla1_cnd_name_first)
            'a1_cnd_name_middle.AppendChild(xmla1_cnd_name_middle)
            a1_cnd_name_last.AppendChild(xmla1_cnd_name_last)
            'id------------------------  
            a1_cnd_id_no.AppendChild(xmla1_cnd_id_no)
            a1_cnd_id_type.AppendChild(xmla1_cnd_id_type)
            'location----------------- 
            'a1_cnd_location_addr.AppendChild(xmla1_cnd_location_addr)
            a1_cnd_location_phone.AppendChild(xmla1_cnd_location_phone)
            'a1_cnd_location_fax.AppendChild(xmla1_cnd_location_fax)
            'office----------------- 
            a1_cnd_office_occ.AppendChild(xmla1_cnd_office_occ)
            'a1_cnd_office_desc.AppendChild(xmla1_cnd_office_desc)
            a1_cnd_office_org.AppendChild(xmla1_cnd_office_org)
            a1_cnd_office_phone.AppendChild(xmla1_cnd_office_phone)
            a1_cnd_office_fax.AppendChild(xmla1_cnd_office_fax)
            'contact---------------- 
            'a1_cnd_contact_addr.AppendChild(xmla1_cnd_contact_addr)
            a1_cnd_contact_phone.AppendChild(xmla1_cnd_contact_phone)
            'a1_cnd_contact_fax.AppendChild(xmla1_cnd_contact_fax)
            'iddoc---------------- 
            'a1_cnd_iddoc_type.AppendChild(xmla1_cnd_iddoc_type)
            'a1_cnd_iddoc_desc.AppendChild(xmla1_cnd_iddoc_desc)
            'a1_cnd_iddoc_no.AppendChild(xmla1_cnd_iddoc_no)
            'a1_cnd_iddoc_by.AppendChild(xmla1_cnd_iddoc_by)
            'a1_cnd_iddoc_date.AppendChild(xmla1_cnd_iddoc_date)
            'a1_cnd_iddoc_expire.AppendChild(xmla1_cnd_iddoc_expire)
            'cnd==========End==================
            For i = 1 To pCountPsn
                a1_psn_relation(i).AppendChild(xmla1_psn_relation(i))
                'name------------------- 
                'a1_psn_name_prefix(i).AppendChild(xmla1_psn_name_prefix(i))
                a1_psn_name_first(i).AppendChild(xmla1_psn_name_first(i))
                'a1_psn_name_middle(i).AppendChild(xmla1_psn_name_middle(i))
                a1_psn_name_last(i).AppendChild(xmla1_psn_name_last(i))
                'id------------------------ 
                a1_psn_id_no(i).AppendChild(xmla1_psn_id_no(i))
                a1_psn_id_type(i).AppendChild(xmla1_psn_id_type(i))
                'location----------------- 
                'a1_psn_location_addr(i).AppendChild(xmla1_psn_location_addr(i))
                a1_psn_location_phone(i).AppendChild(xmla1_psn_location_phone(i))
                'a1_psn_location_fax(i).AppendChild(xmla1_psn_location_fax(i))
                'office----------------- 
                a1_psn_office_occ(i).AppendChild(xmla1_psn_office_occ(i))
                a1_psn_office_org(i).AppendChild(xmla1_psn_office_org(i))
                a1_psn_office_phone(i).AppendChild(xmla1_psn_office_phone(i))
                a1_psn_office_fax(i).AppendChild(xmla1_psn_office_fax(i))
                a1_psn_office_type(i).AppendChild(xmla1_psn_office_type(i))
                'a1_psn_office_desc(i).AppendChild(xmla1_psn_office_desc(i))
                'contact---------------- 
                'a1_psn_contact_addr(i).AppendChild(xmla1_psn_contact_addr(i))
                a1_psn_contact_phone(i).AppendChild(xmla1_psn_contact_phone(i))
                'a1_psn_contact_fax(i).AppendChild(xmla1_psn_contact_fax(i))
                'iddoc---------------- 
                'a1_psn_iddoc_type(i).AppendChild(xmla1_psn_iddoc_type(i))
                'a1_psn_iddoc_desc(i).AppendChild(xmla1_psn_iddoc_desc(i))
                'a1_psn_iddoc_no(i).AppendChild(xmla1_psn_iddoc_no(i))
                'a1_psn_iddoc_by(i).AppendChild(xmla1_psn_iddoc_by(i))
                'a1_psn_iddoc_date(i).AppendChild(xmla1_psn_iddoc_date(i))
                'a1_psn_iddoc_expire(i).AppendChild(xmla1_psn_iddoc_expire(i))
                'psn==========End==================

            Next
            'psn==========Begin================== 

            'tsc==========Begin================== 
            a1_tsc_date.AppendChild(xmla1_tsc_date)
            'contact---------------- 
            a1_tsc_item_type.AppendChild(xmla1_tsc_item_type)
            'a1_tsc_item_desc.AppendChild(xmla1_tsc_item_desc)
            a1_tsc_item_accno.AppendChild(xmla1_tsc_item_accno)
            'a1_tsc_item_cur.AppendChild(xmla1_tsc_item_cur)
            a1_tsc_item_amt.AppendChild(xmla1_tsc_item_amt)
            'name------------------- 
            'a1_tsc_name_prefix.AppendChild(xmla1_tsc_name_prefix)
            a1_tsc_name_first.AppendChild(xmla1_tsc_name_first)
            'a1_tsc_name_middle.AppendChild(xmla1_tsc_name_middle)
            a1_tsc_name_last.AppendChild(xmla1_tsc_name_last)
            'obj---------------- 
            a1_tsc_obj_type.AppendChild(xmla1_tsc_obj_type)
            'a1_tsc_obj_desc.AppendChild(xmla1_tsc_obj_desc)
            'tsc==========End==================
            'record==========Begin================== 
            a1_record_writer.AppendChild(xmla1_record_writer)
            a1_record_sign.AppendChild(xmla1_record_sign)
            a1_record_date.AppendChild(xmla1_record_date)
            'record==========End==================

            '// Save to the XML file

            'xmldoc.Save(filePath)

            'Dim FileStream As StreamReader = New StreamReader(filePath)
            'Dim fileContent As String = FileStream.ReadToEnd()
            'FileStream.Close()

            ''Dim ansiWriter As StreamWriter = New StreamWriter(filePath.Replace(".xml", "-ansi.xml"), False)
            'Dim ansiWriter As StreamWriter = New StreamWriter(filePath.Replace(".xml", "-ansi.xml"), False, Encoding.GetEncoding(1250))
            Dim ansiWriter As StreamWriter
            ansiWriter = New StreamWriter(filePath, False, Encoding.Default)
            xmldoc.Save(ansiWriter)
            '' ansiWriter.Write(fileContent, Encoding.Default)
            ansiWriter.Close()
            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function

    Public Function AddAMLO2node(ByVal filePath As String, ByVal pAmlo2Data As clsAmlo2Data, ByVal pCountPsn As Integer, ByVal pAmlo2Psn() As clsAmlo2Psn, ByVal intLoop As Integer, ByVal intMaxLoop As Integer) As Boolean
        Try
            Dim i As Integer
            Dim xmldoc As XmlDocument
            xmldoc = New XmlDocument()
            xmldoc.Load(filePath)
            Dim parentNode As XmlElement
            parentNode = xmldoc.CreateElement("doc")
            Dim a0_version As XmlElement
            Dim a0_org As XmlElement
            Dim xmla0_version As XmlText
            Dim xmla0_org As XmlText
            clsDateFormat = New clsDateFormat

            If Not (IsDBNull(xmldoc.DocumentElement)) Then
                xmldoc.DocumentElement.PrependChild(parentNode)
                If (intLoop = intMaxLoop) Then
                    a0_org = xmldoc.CreateElement("org")
                    a0_version = xmldoc.CreateElement("version")

                    xmla0_org = xmldoc.CreateTextNode("ธนาคารอาคารสงเคราะห์")
                    xmla0_version = xmldoc.CreateTextNode("1.1")

                    xmldoc.DocumentElement.PrependChild(a0_org)
                    xmldoc.DocumentElement.PrependChild(a0_version)

                    a0_org.AppendChild(xmla0_org)
                    a0_version.AppendChild(xmla0_version)

                End If

            End If

            ' Create the required nodes 

            Dim a1_type As XmlElement
            Dim a1_reportid As XmlElement
            'Dim a1_revision As XmlElement
            Dim a1_date As XmlElement
            'cnd==========Begin==================
            Dim a1_cnd As XmlElement
            'name-------------------
            Dim a1_cnd_name As XmlElement
            'Dim a1_cnd_name_prefix As XmlElement
            Dim a1_cnd_name_first As XmlElement
            'Dim a1_cnd_name_middle As XmlElement
            Dim a1_cnd_name_last As XmlElement
            'id------------------------
            Dim a1_cnd_id As XmlElement
            Dim a1_cnd_id_no As XmlElement
            Dim a1_cnd_id_type As XmlElement
            'location-----------------
            Dim a1_cnd_location As XmlElement
            'Dim a1_cnd_location_addr As XmlElement
            Dim a1_cnd_location_phone As XmlElement
            'Dim a1_cnd_location_fax As XmlElement
            'office-----------------
            Dim a1_cnd_office As XmlElement
            Dim a1_cnd_office_occ As XmlElement
            'Dim a1_cnd_office_desc As XmlElement
            Dim a1_cnd_office_org As XmlElement
            Dim a1_cnd_office_phone As XmlElement
            Dim a1_cnd_office_fax As XmlElement
            'contact----------------
            Dim a1_cnd_contact As XmlElement
            'Dim a1_cnd_contact_addr As XmlElement
            Dim a1_cnd_contact_phone As XmlElement
            'Dim a1_cnd_contact_fax As XmlElement
            'iddoc----------------
            'Dim a1_cnd_iddoc As XmlElement
            'Dim a1_cnd_iddoc_type As XmlElement
            'Dim a1_cnd_iddoc_desc As XmlElement
            'Dim a1_cnd_iddoc_no As XmlElement
            'Dim a1_cnd_iddoc_by As XmlElement
            'Dim a1_cnd_iddoc_date As XmlElement
            'Dim a1_cnd_iddoc_expire As XmlElement
            'cnd==========End==================
            'psn==========Begin==================
            Dim a1_psn(pCountPsn) As XmlElement
            Dim a1_psn_relation(pCountPsn) As XmlElement
            'name-------------------
            Dim a1_psn_name(pCountPsn) As XmlElement
            'Dim a1_psn_name_prefix(pCountPsn) As XmlElement
            Dim a1_psn_name_first(pCountPsn) As XmlElement
            'Dim a1_psn_name_middle(pCountPsn) As XmlElement
            Dim a1_psn_name_last(pCountPsn) As XmlElement
            'id------------------------
            Dim a1_psn_id(pCountPsn) As XmlElement
            Dim a1_psn_id_no(pCountPsn) As XmlElement
            Dim a1_psn_id_type(pCountPsn) As XmlElement
            'location-----------------
            Dim a1_psn_location(pCountPsn) As XmlElement
            'Dim a1_psn_location_addr(pCountPsn) As XmlElement
            Dim a1_psn_location_phone(pCountPsn) As XmlElement
            'Dim a1_psn_location_fax(pCountPsn) As XmlElement
            'office-----------------
            Dim a1_psn_office(pCountPsn) As XmlElement
            Dim a1_psn_office_occ(pCountPsn) As XmlElement
            Dim a1_psn_office_org(pCountPsn) As XmlElement
            Dim a1_psn_office_phone(pCountPsn) As XmlElement
            Dim a1_psn_office_fax(pCountPsn) As XmlElement
            Dim a1_psn_office_type(pCountPsn) As XmlElement
            'Dim a1_psn_office_desc(pCountPsn) As XmlElement
            'contact----------------
            Dim a1_psn_contact(pCountPsn) As XmlElement
            'Dim a1_psn_contact_addr(pCountPsn) As XmlElement
            Dim a1_psn_contact_phone(pCountPsn) As XmlElement
            'Dim a1_psn_contact_fax(pCountPsn) As XmlElement
            'iddoc----------------
            'Dim a1_psn_iddoc(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_type(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_desc(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_no(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_by(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_date(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_expire(pCountPsn) As XmlElement
            'psn==========End==================

            'tsc==========Begin==================
            Dim a1_tsc As XmlElement
            Dim a1_tsc_date As XmlElement
            Dim a1_tsc_type As XmlElement
            'Dim a1_tsc_desc As XmlElement

            'asset---------------- 
            Dim a1_tsc_asset As XmlElement
            Dim a1_tsc_asset_type As XmlElement
            'Dim a1_tsc_asset_desc As XmlElement
            Dim a1_tsc_asset_detail As XmlElement
            Dim a1_tsc_asset_amt As XmlElement
            'acc-------------------   
            Dim a1_tsc_acc As XmlElement
            Dim a1_tsc_acc_accno As XmlElement
            Dim a1_tsc_acc_aname As XmlElement
            'acc_name------------------- 
            Dim a1_tsc_acc_name As XmlElement
            'Dim a1_tsc_acc_name_prefix As XmlElement
            Dim a1_tsc_acc_name_first As XmlElement
            'Dim a1_tsc_acc_name_middle As XmlElement
            Dim a1_tsc_acc_name_last As XmlElement
            'racc---------------- 
            Dim a1_tsc_racc As XmlElement
            Dim a1_tsc_racc_accno As XmlElement
            Dim a1_tsc_racc_aname As XmlElement
            'racc_name------------------- 
            Dim a1_tsc_racc_name As XmlElement
            'Dim a1_tsc_racc_name_prefix As XmlElement
            Dim a1_tsc_racc_name_first As XmlElement
            'Dim a1_tsc_racc_name_middle As XmlElement
            Dim a1_tsc_racc_name_last As XmlElement
            'racc---------------- 
            Dim a1_tsc_racc_relation As XmlElement
            Dim a1_tsc_racc_relation_type As XmlElement
            'Dim a1_tsc_racc_relation_desc As XmlElement
            'name------------------- 
            Dim a1_tsc_name As XmlElement
            'Dim a1_tsc_name_prefix As XmlElement
            Dim a1_tsc_name_first As XmlElement
            'Dim a1_tsc_name_middle As XmlElement
            Dim a1_tsc_name_last As XmlElement
            'obj------------------- 
            Dim a1_tsc_obj As XmlElement
            Dim a1_tsc_obj_type As XmlElement
            'Dim a1_tsc_obj_desc As XmlElement

            'tsc==========End==================
            'record==========Begin==================
            Dim a1_record As XmlElement
            Dim a1_record_writer As XmlElement
            Dim a1_record_sign As XmlElement
            Dim a1_record_date As XmlElement
            'record==========End==================



            a1_type = xmldoc.CreateElement("type")
            a1_reportid = xmldoc.CreateElement("reportid")
            'a1_revision = xmldoc.CreateElement("revision")
            a1_date = xmldoc.CreateElement("date")
            'cnd==========Begin==================
            a1_cnd = xmldoc.CreateElement("cnd")
            'name-------------------
            a1_cnd_name = xmldoc.CreateElement("name")
            'a1_cnd_name_prefix = xmldoc.CreateElement("prefix")
            a1_cnd_name_first = xmldoc.CreateElement("first")
            'a1_cnd_name_middle = xmldoc.CreateElement("middle")
            a1_cnd_name_last = xmldoc.CreateElement("last")
            'id------------------------
            a1_cnd_id = xmldoc.CreateElement("id")
            a1_cnd_id_no = xmldoc.CreateElement("no")
            a1_cnd_id_type = xmldoc.CreateElement("type")
            'location-----------------
            a1_cnd_location = xmldoc.CreateElement("location")
            'a1_cnd_location_addr = xmldoc.CreateElement("addr")
            a1_cnd_location_phone = xmldoc.CreateElement("phone")
            'a1_cnd_location_fax = xmldoc.CreateElement("fax")
            'office-----------------
            a1_cnd_office = xmldoc.CreateElement("office")
            a1_cnd_office_occ = xmldoc.CreateElement("occ")
            'a1_cnd_office_desc = xmldoc.CreateElement("desc")
            a1_cnd_office_org = xmldoc.CreateElement("org")
            a1_cnd_office_phone = xmldoc.CreateElement("phone")
            a1_cnd_office_fax = xmldoc.CreateElement("fax")
            'contact----------------
            a1_cnd_contact = xmldoc.CreateElement("contact")
            'a1_cnd_contact_addr = xmldoc.CreateElement("addr")
            a1_cnd_contact_phone = xmldoc.CreateElement("phone")
            'a1_cnd_contact_fax = xmldoc.CreateElement("fax")
            'iddoc----------------
            'a1_cnd_iddoc = xmldoc.CreateElement("iddoc")
            'a1_cnd_iddoc_type = xmldoc.CreateElement("type")
            'a1_cnd_iddoc_desc = xmldoc.CreateElement("desc")
            'a1_cnd_iddoc_no = xmldoc.CreateElement("no")
            'a1_cnd_iddoc_by = xmldoc.CreateElement("by")
            'a1_cnd_iddoc_date = xmldoc.CreateElement("date")
            'a1_cnd_iddoc_expire = xmldoc.CreateElement("expire")
            'cnd==========End==================

            For i = 1 To pCountPsn
                'psn==========Begin==================
                a1_psn(i) = xmldoc.CreateElement("psn")
                a1_psn_relation(i) = xmldoc.CreateElement("relation")
                'name-------------------
                a1_psn_name(i) = xmldoc.CreateElement("name")
                'a1_psn_name_prefix(i) = xmldoc.CreateElement("prefix")
                a1_psn_name_first(i) = xmldoc.CreateElement("first")
                'a1_psn_name_middle(i) = xmldoc.CreateElement("middle")
                a1_psn_name_last(i) = xmldoc.CreateElement("last")
                'id------------------------
                a1_psn_id(i) = xmldoc.CreateElement("id")
                a1_psn_id_no(i) = xmldoc.CreateElement("no")
                a1_psn_id_type(i) = xmldoc.CreateElement("type")
                'location-----------------
                a1_psn_location(i) = xmldoc.CreateElement("location")
                'a1_psn_location_addr(i) = xmldoc.CreateElement("addr")
                a1_psn_location_phone(i) = xmldoc.CreateElement("phone")
                'a1_psn_location_fax(i) = xmldoc.CreateElement("fax")
                'office-----------------
                a1_psn_office(i) = xmldoc.CreateElement("office")
                a1_psn_office_occ(i) = xmldoc.CreateElement("occ")
                a1_psn_office_org(i) = xmldoc.CreateElement("org")
                a1_psn_office_phone(i) = xmldoc.CreateElement("phone")
                a1_psn_office_fax(i) = xmldoc.CreateElement("fax")
                a1_psn_office_type(i) = xmldoc.CreateElement("type")
                'a1_psn_office_desc(i) = xmldoc.CreateElement("desc")
                'contact----------------
                a1_psn_contact(i) = xmldoc.CreateElement("contact")
                'a1_psn_contact_addr(i) = xmldoc.CreateElement("addr")
                a1_psn_contact_phone(i) = xmldoc.CreateElement("phone")
                'a1_psn_contact_fax(i) = xmldoc.CreateElement("fax")
                'iddoc----------------
                'a1_psn_iddoc(i) = xmldoc.CreateElement("iddoc")
                'a1_psn_iddoc_type(i) = xmldoc.CreateElement("type")
                'a1_psn_iddoc_desc(i) = xmldoc.CreateElement("desc")
                'a1_psn_iddoc_no(i) = xmldoc.CreateElement("no")
                'a1_psn_iddoc_by(i) = xmldoc.CreateElement("by")
                'a1_psn_iddoc_date(i) = xmldoc.CreateElement("date")
                'a1_psn_iddoc_expire(i) = xmldoc.CreateElement("expire")
                'psn==========End==================
            Next


            'tsc==========Begin==================
            a1_tsc = xmldoc.CreateElement("tsc")
            a1_tsc_date = xmldoc.CreateElement("date")
            a1_tsc_type = xmldoc.CreateElement("type")
            'a1_tsc_desc = xmldoc.CreateElement("desc")

            'asset---------------- 
            a1_tsc_asset = xmldoc.CreateElement("asset")
            a1_tsc_asset_type = xmldoc.CreateElement("type")
            'a1_tsc_asset_desc = xmldoc.CreateElement("desc")
            a1_tsc_asset_detail = xmldoc.CreateElement("detail")
            a1_tsc_asset_amt = xmldoc.CreateElement("amt")

            'acc-------------------   
            a1_tsc_acc = xmldoc.CreateElement("acc")
            a1_tsc_acc_accno = xmldoc.CreateElement("accno")
            a1_tsc_acc_aname = xmldoc.CreateElement("aname")
            'acc_name------------------- 
            a1_tsc_acc_name = xmldoc.CreateElement("name")
            'a1_tsc_acc_name_prefix = xmldoc.CreateElement("prefix")
            a1_tsc_acc_name_first = xmldoc.CreateElement("first")
            'a1_tsc_acc_name_middle = xmldoc.CreateElement("middle")
            a1_tsc_acc_name_last = xmldoc.CreateElement("last")
            'racc---------------- 
            a1_tsc_racc = xmldoc.CreateElement("racc")
            a1_tsc_racc_accno = xmldoc.CreateElement("accno")
            a1_tsc_racc_aname = xmldoc.CreateElement("aname")
            'racc_name------------------- 
            a1_tsc_racc_name = xmldoc.CreateElement("name")
            'a1_tsc_racc_name_prefix = xmldoc.CreateElement("prefix")
            a1_tsc_racc_name_first = xmldoc.CreateElement("first")
            'a1_tsc_racc_name_middle = xmldoc.CreateElement("middle")
            a1_tsc_racc_name_last = xmldoc.CreateElement("last")
            'racc---------------- 
            a1_tsc_racc_relation = xmldoc.CreateElement("relation")
            a1_tsc_racc_relation_type = xmldoc.CreateElement("type")
            'a1_tsc_racc_relation_desc = xmldoc.CreateElement("desc")
            'name------------------- 
            a1_tsc_name = xmldoc.CreateElement("name")
            'a1_tsc_name_prefix = xmldoc.CreateElement("prefix")
            a1_tsc_name_first = xmldoc.CreateElement("first")
            'a1_tsc_name_middle = xmldoc.CreateElement("middle")
            a1_tsc_name_last = xmldoc.CreateElement("last")
            'obj------------------- 
            a1_tsc_obj = xmldoc.CreateElement("obj")
            a1_tsc_obj_type = xmldoc.CreateElement("type")
            'a1_tsc_obj_desc = xmldoc.CreateElement("desc")


            'tsc==========End==================
            'record==========Begin==================
            a1_record = xmldoc.CreateElement("record")
            a1_record_writer = xmldoc.CreateElement("writer")
            a1_record_sign = xmldoc.CreateElement("sign")
            a1_record_date = xmldoc.CreateElement("date")
            'record==========End==================

            Dim xmla1_type As XmlText
            Dim xmla1_reportid As XmlText
            'Dim xmla1_revision As XmlText
            Dim xmla1_date As XmlText
            'cnd==========Begin==================
            ' Dim xmla1_cnd As XmlText
            'name-------------------
            'Dim xmla1_cnd_name As XmlText
            'Dim xmla1_cnd_name_prefix As XmlText
            Dim xmla1_cnd_name_first As XmlText
            'Dim xmla1_cnd_name_middle As XmlText
            Dim xmla1_cnd_name_last As XmlText
            'id------------------------
            'Dim xmla1_cnd_id As XmlText
            Dim xmla1_cnd_id_no As XmlText
            Dim xmla1_cnd_id_type As XmlText
            'location-----------------
            'Dim xmla1_cnd_location As XmlText
            'Dim xmla1_cnd_location_addr As XmlText
            Dim xmla1_cnd_location_phone As XmlText
            'Dim xmla1_cnd_location_fax As XmlText
            'office-----------------
            'Dim xmla1_cnd_office As XmlText
            Dim xmla1_cnd_office_occ As XmlText
            'Dim xmla1_cnd_office_desc As XmlText
            Dim xmla1_cnd_office_org As XmlText
            Dim xmla1_cnd_office_phone As XmlText
            Dim xmla1_cnd_office_fax As XmlText
            'contact----------------
            'Dim xmla1_cnd_contact As XmlText
            'Dim xmla1_cnd_contact_addr As XmlText
            Dim xmla1_cnd_contact_phone As XmlText
            'Dim xmla1_cnd_contact_fax As XmlText
            'iddoc----------------
            'Dim xmla1_cnd_iddoc As XmlText
            'Dim xmla1_cnd_iddoc_type As XmlText
            'Dim xmla1_cnd_iddoc_desc As XmlText
            'Dim xmla1_cnd_iddoc_no As XmlText
            'Dim xmla1_cnd_iddoc_by As XmlText
            'Dim xmla1_cnd_iddoc_date As XmlText
            'Dim xmla1_cnd_iddoc_expire As XmlText
            'cnd==========End==================
            'psn==========Begin==================
            'Dim xmla1_psn As XmlText
            Dim xmla1_psn_relation(pCountPsn) As XmlText
            'name-------------------
            'Dim xmla1_psn_name As XmlText
            'Dim xmla1_psn_name_prefix(pCountPsn) As XmlText
            Dim xmla1_psn_name_first(pCountPsn) As XmlText
            'Dim xmla1_psn_name_middle(pCountPsn) As XmlText
            Dim xmla1_psn_name_last(pCountPsn) As XmlText
            'id------------------------
            'Dim xmla1_psn_id As XmlText
            Dim xmla1_psn_id_no(pCountPsn) As XmlText
            Dim xmla1_psn_id_type(pCountPsn) As XmlText
            'location-----------------
            'Dim xmla1_psn_location As XmlText
            'Dim xmla1_psn_location_addr(pCountPsn) As XmlText
            Dim xmla1_psn_location_phone(pCountPsn) As XmlText
            'Dim xmla1_psn_location_fax(pCountPsn) As XmlText
            'office-----------------
            'Dim xmla1_psn_office As XmlText
            Dim xmla1_psn_office_occ(pCountPsn) As XmlText
            Dim xmla1_psn_office_org(pCountPsn) As XmlText
            Dim xmla1_psn_office_phone(pCountPsn) As XmlText
            Dim xmla1_psn_office_fax(pCountPsn) As XmlText
            Dim xmla1_psn_office_type(pCountPsn) As XmlText
            'Dim xmla1_psn_office_desc(pCountPsn) As XmlText
            'contact----------------
            'Dim xmla1_psn_contact As XmlText
            'Dim xmla1_psn_contact_addr(pCountPsn) As XmlText
            Dim xmla1_psn_contact_phone(pCountPsn) As XmlText
            'Dim xmla1_psn_contact_fax(pCountPsn) As XmlText
            'iddoc----------------
            'Dim xmla1_psn_iddoc As XmlText
            'Dim xmla1_psn_iddoc_type(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_desc(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_no(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_by(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_date(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_expire(pCountPsn) As XmlText
            'psn==========End==================

            'tsc==========Begin==================
            'Dim xmla1_tsc As XmlText
            Dim xmla1_tsc_date As XmlText
            Dim xmla1_tsc_type As XmlText
            'Dim xmla1_tsc_desc As XmlText

            'asset----------------  
            Dim xmla1_tsc_asset_type As XmlText
            'Dim xmla1_tsc_asset_desc As XmlText
            Dim xmla1_tsc_asset_detail As XmlText
            Dim xmla1_tsc_asset_amt As XmlText

            'acc-------------------   

            Dim xmla1_tsc_acc_accno As XmlText
            Dim xmla1_tsc_acc_aname As XmlText
            'acc_name------------------- 

            'Dim xmla1_tsc_acc_name_prefix As XmlText
            Dim xmla1_tsc_acc_name_first As XmlText
            'Dim xmla1_tsc_acc_name_middle As XmlText
            Dim xmla1_tsc_acc_name_last As XmlText

            'racc---------------- 

            Dim xmla1_tsc_racc_accno As XmlText
            Dim xmla1_tsc_racc_aname As XmlText
            'racc_name------------------- 

            'Dim xmla1_tsc_racc_name_prefix As XmlText
            Dim xmla1_tsc_racc_name_first As XmlText
            'Dim xmla1_tsc_racc_name_middle As XmlText
            Dim xmla1_tsc_racc_name_last As XmlText
            'racc---------------- 

            Dim xmla1_tsc_racc_relation_type As XmlText
            'Dim xmla1_tsc_racc_relation_desc As XmlText


            'name-------------------
            'Dim xmla1_tsc_name As XmlText
            'Dim xmla1_tsc_name_prefix As XmlText
            Dim xmla1_tsc_name_first As XmlText
            'Dim xmla1_tsc_name_middle As XmlText
            Dim xmla1_tsc_name_last As XmlText
            'obj----------------
            'Dim xmla1_tsc_obj As XmlText
            Dim xmla1_tsc_obj_type As XmlText
            'Dim xmla1_tsc_obj_desc As XmlText
            'tsc==========End==================
            'record==========Begin==================
            'Dim xmla1_record As XmlText
            Dim xmla1_record_writer As XmlText
            Dim xmla1_record_sign As XmlText
            Dim xmla1_record_date As XmlText
            'record==========End==================

            xmla1_type = xmldoc.CreateTextNode(pAmlo2Data.p01_type)
            xmla1_reportid = xmldoc.CreateTextNode(pAmlo2Data.p02_reportid)
            'xmla1_revision = xmldoc.CreateTextNode(pAmlo2Data.p03_revision)
            xmla1_date = xmldoc.CreateTextNode(pAmlo2Data.p04_date)
            'cnd==========Begin================== 
            'name------------------- 
            'xmla1_cnd_name_prefix = xmldoc.CreateTextNode(pAmlo2Data.p101_cnd_name_prefix)
            xmla1_cnd_name_first = xmldoc.CreateTextNode(pAmlo2Data.p102_cnd_name_first)
            'xmla1_cnd_name_middle = xmldoc.CreateTextNode(pAmlo2Data.p103_cnd_name_middle)
            xmla1_cnd_name_last = xmldoc.CreateTextNode(pAmlo2Data.p104_cnd_name_last)
            'id------------------------ 
            xmla1_cnd_id_no = xmldoc.CreateTextNode(pAmlo2Data.p105_cnd_id_no)
            xmla1_cnd_id_type = xmldoc.CreateTextNode(pAmlo2Data.p106_cnd_id_type)
            'location----------------- 
            'xmla1_cnd_location_addr = xmldoc.CreateTextNode(pAmlo2Data.p107_cnd_location_addr)
            xmla1_cnd_location_phone = xmldoc.CreateTextNode(pAmlo2Data.p108_cnd_location_phone)
            'xmla1_cnd_location_fax = xmldoc.CreateTextNode(pAmlo2Data.p109_cnd_location_fax)
            'office----------------- 
            xmla1_cnd_office_occ = xmldoc.CreateTextNode(pAmlo2Data.p110_cnd_office_occ)
            'xmla1_cnd_office_desc = xmldoc.CreateTextNode(pAmlo2Data.p111_cnd_office_desc)
            xmla1_cnd_office_org = xmldoc.CreateTextNode(pAmlo2Data.p112_cnd_office_org)
            xmla1_cnd_office_phone = xmldoc.CreateTextNode(pAmlo2Data.p113_cnd_office_phone)
            xmla1_cnd_office_fax = xmldoc.CreateTextNode(pAmlo2Data.p114_cnd_office_fax)
            'contact---------------- 
            'xmla1_cnd_contact_addr = xmldoc.CreateTextNode(pAmlo2Data.p115_cnd_contact_addr)
            xmla1_cnd_contact_phone = xmldoc.CreateTextNode(pAmlo2Data.p116_cnd_contact_phone)
            'xmla1_cnd_contact_fax = xmldoc.CreateTextNode(pAmlo2Data.p117_cnd_contact_fax)
            'iddoc---------------- 
            'xmla1_cnd_iddoc_type = xmldoc.CreateTextNode(pAmlo2Data.p118_cnd_iddoc_type)
            'xmla1_cnd_iddoc_desc = xmldoc.CreateTextNode(pAmlo2Data.p119_cnd_iddoc_desc)
            'xmla1_cnd_iddoc_no = xmldoc.CreateTextNode(pAmlo2Data.p120_cnd_iddoc_no)
            'xmla1_cnd_iddoc_by = xmldoc.CreateTextNode(pAmlo2Data.p121_cnd_iddoc_by)
            'xmla1_cnd_iddoc_date = xmldoc.CreateTextNode(pAmlo2Data.p122_cnd_iddoc_date)
            'xmla1_cnd_iddoc_expire = xmldoc.CreateTextNode(pAmlo2Data.p123_cnd_iddoc_expire)
            'cnd==========End==================
            For i = 1 To pCountPsn
                'psn==========Begin================== 
                xmla1_psn_relation(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p201_psn_relation)
                'name------------------- 
                'xmla1_psn_name_prefix(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p202_psn_name_prefix)
                xmla1_psn_name_first(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p203_psn_name_first)
                'xmla1_psn_name_middle(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p204_psn_name_middle)
                xmla1_psn_name_last(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p205_psn_name_last)
                'id------------------------ 
                xmla1_psn_id_no(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p206_psn_id_no)
                xmla1_psn_id_type(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p207_psn_id_type)
                'location----------------- 
                'xmla1_psn_location_addr(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p208_psn_location_addr)
                xmla1_psn_location_phone(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p209_psn_location_phone)
                'xmla1_psn_location_fax(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p210_psn_location_fax)
                'office----------------- 
                xmla1_psn_office_occ(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p211_psn_office_occ)
                xmla1_psn_office_org(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p212_psn_office_org)
                xmla1_psn_office_phone(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p213_psn_office_phone)
                xmla1_psn_office_fax(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p214_psn_office_fax)
                xmla1_psn_office_type(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p215_psn_office_type)
                'xmla1_psn_office_desc(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p216_psn_office_desc)
                'contact---------------- 
                'xmla1_psn_contact_addr(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p217_psn_contact_addr)
                xmla1_psn_contact_phone(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p218_psn_contact_phone)
                'xmla1_psn_contact_fax(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p219_psn_contact_fax)
                'iddoc---------------- 
                'xmla1_psn_iddoc_type(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p220_psn_iddoc_type)
                'xmla1_psn_iddoc_desc(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p221_psn_iddoc_desc)
                'xmla1_psn_iddoc_no(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p222_psn_iddoc_no)
                'xmla1_psn_iddoc_by(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p223_psn_iddoc_by)
                'xmla1_psn_iddoc_date(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p224_psn_iddoc_date)
                'xmla1_psn_iddoc_expire(i) = xmldoc.CreateTextNode(pAmlo2Psn(i).p225_psn_iddoc_expire)
                'psn==========End==================
            Next i
            'tsc==========Begin================== 
            xmla1_tsc_date = xmldoc.CreateTextNode(pAmlo2Data.p301_tsc_date)
            xmla1_tsc_type = xmldoc.CreateTextNode(pAmlo2Data.p302_tsc_type)
            'xmla1_tsc_desc = xmldoc.CreateTextNode(pAmlo2Data.p303_tsc_desc)

            'asset----------------  
            xmla1_tsc_asset_type = xmldoc.CreateTextNode(pAmlo2Data.p304_tsc_asset_type)
            'xmla1_tsc_asset_desc = xmldoc.CreateTextNode(pAmlo2Data.p305_tsc_asset_desc)
            xmla1_tsc_asset_detail = xmldoc.CreateTextNode(pAmlo2Data.p306_tsc_asset_detail)
            xmla1_tsc_asset_amt = xmldoc.CreateTextNode(pAmlo2Data.p307_tsc_asset_amt)
            'acc-------------------    
            xmla1_tsc_acc_accno = xmldoc.CreateTextNode(pAmlo2Data.p308_tsc_acc_accno)
            xmla1_tsc_acc_aname = xmldoc.CreateTextNode(pAmlo2Data.p309_tsc_acc_aname)
            'acc_name-------------------  
            'xmla1_tsc_acc_name_prefix = xmldoc.CreateTextNode(pAmlo2Data.p310_tsc_acc_name_prefix)
            xmla1_tsc_acc_name_first = xmldoc.CreateTextNode(pAmlo2Data.p311_tsc_acc_name_first)
            'xmla1_tsc_acc_name_middle = xmldoc.CreateTextNode(pAmlo2Data.p312_tsc_acc_name_middle)
            xmla1_tsc_acc_name_last = xmldoc.CreateTextNode(pAmlo2Data.p313_tsc_acc_name_last)
            'racc----------------  
            xmla1_tsc_racc_accno = xmldoc.CreateTextNode(pAmlo2Data.p314_tsc_racc_accno)
            xmla1_tsc_racc_aname = xmldoc.CreateTextNode(pAmlo2Data.p315_tsc_racc_aname)
            'racc_name-------------------   
            'xmla1_tsc_racc_name_prefix = xmldoc.CreateTextNode(pAmlo2Data.p316_tsc_racc_name_prefix)
            xmla1_tsc_racc_name_first = xmldoc.CreateTextNode(pAmlo2Data.p317_tsc_racc_name_first)
            'xmla1_tsc_racc_name_middle = xmldoc.CreateTextNode(pAmlo2Data.p318_tsc_racc_name_middle)
            xmla1_tsc_racc_name_last = xmldoc.CreateTextNode(pAmlo2Data.p319_tsc_racc_name_last)
            'racc---------------- 
            xmla1_tsc_racc_relation_type = xmldoc.CreateTextNode(pAmlo2Data.p320_tsc_racc_relation_type)
            'xmla1_tsc_racc_relation_desc = xmldoc.CreateTextNode(pAmlo2Data.p321_tsc_racc_relation_desc)
            'name-------------------  
            'xmla1_tsc_name_prefix = xmldoc.CreateTextNode(pAmlo2Data.p322_tsc_name_prefix)
            xmla1_tsc_name_first = xmldoc.CreateTextNode(pAmlo2Data.p323_tsc_name_first)
            'xmla1_tsc_name_middle = xmldoc.CreateTextNode(pAmlo2Data.p324_tsc_name_middle)
            xmla1_tsc_name_last = xmldoc.CreateTextNode(pAmlo2Data.p325_tsc_name_last)

            'obj---------------- 
            xmla1_tsc_obj_type = xmldoc.CreateTextNode(pAmlo2Data.p326_tsc_obj_type)
            'xmla1_tsc_obj_desc = xmldoc.CreateTextNode(pAmlo2Data.p327_tsc_obj_desc)
            'tsc==========End==================
            'record==========Begin================== 
            xmla1_record_writer = xmldoc.CreateTextNode(pAmlo2Data.p401_record_writer)
            xmla1_record_sign = xmldoc.CreateTextNode(pAmlo2Data.p402_record_sign)
            xmla1_record_date = xmldoc.CreateTextNode(pAmlo2Data.p403_record_date)
            'record==========End==================

            '// append the nodes to the parentNode without the value
            parentNode.AppendChild(a1_type)
            parentNode.AppendChild(a1_reportid)
            'parentNode.AppendChild(a1_revision)
            parentNode.AppendChild(a1_date)
            'cnd==========Begin==================
            parentNode.AppendChild(a1_cnd)
            'name-------------------
            a1_cnd.AppendChild(a1_cnd_name)
            'a1_cnd_name.AppendChild(a1_cnd_name_prefix)
            a1_cnd_name.AppendChild(a1_cnd_name_first)
            'a1_cnd_name.AppendChild(a1_cnd_name_middle)
            a1_cnd_name.AppendChild(a1_cnd_name_last)
            'id------------------------
            a1_cnd.AppendChild(a1_cnd_id)
            a1_cnd_id.AppendChild(a1_cnd_id_no)
            a1_cnd_id.AppendChild(a1_cnd_id_type)
            'location-----------------
            a1_cnd.AppendChild(a1_cnd_location)
            'a1_cnd_location.AppendChild(a1_cnd_location_addr)
            a1_cnd_location.AppendChild(a1_cnd_location_phone)
            'a1_cnd_location.AppendChild(a1_cnd_location_fax)
            'office-----------------
            a1_cnd.AppendChild(a1_cnd_office)
            a1_cnd_office.AppendChild(a1_cnd_office_occ)
            'a1_cnd_office.AppendChild(a1_cnd_office_desc)
            a1_cnd_office.AppendChild(a1_cnd_office_org)
            a1_cnd_office.AppendChild(a1_cnd_office_phone)
            a1_cnd_office.AppendChild(a1_cnd_office_fax)
            'contact----------------
            a1_cnd.AppendChild(a1_cnd_contact)
            'a1_cnd_contact.AppendChild(a1_cnd_contact_addr)
            a1_cnd_contact.AppendChild(a1_cnd_contact_phone)
            'a1_cnd_contact.AppendChild(a1_cnd_contact_fax)
            'iddoc----------------
            'a1_cnd.AppendChild(a1_cnd_iddoc)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_type)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_desc)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_no)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_by)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_date)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_expire)
            'cnd==========End==================
            For i = 1 To pCountPsn
                'psn==========Begin==================
                parentNode.AppendChild(a1_psn(i))
                a1_psn(i).AppendChild(a1_psn_relation(i))
                'name-------------------
                a1_psn(i).AppendChild(a1_psn_name(i))
                'a1_psn_name(i).AppendChild(a1_psn_name_prefix(i))
                a1_psn_name(i).AppendChild(a1_psn_name_first(i))
                'a1_psn_name(i).AppendChild(a1_psn_name_middle(i))
                a1_psn_name(i).AppendChild(a1_psn_name_last(i))
                'id------------------------
                a1_psn(i).AppendChild(a1_psn_id(i))
                a1_psn_id(i).AppendChild(a1_psn_id_no(i))
                a1_psn_id(i).AppendChild(a1_psn_id_type(i))
                'location-----------------
                a1_psn(i).AppendChild(a1_psn_location(i))
                'a1_psn_location(i).AppendChild(a1_psn_location_addr(i))
                a1_psn_location(i).AppendChild(a1_psn_location_phone(i))
                'a1_psn_location(i).AppendChild(a1_psn_location_fax(i))
                'office-----------------
                a1_psn(i).AppendChild(a1_psn_office(i))
                a1_psn_office(i).AppendChild(a1_psn_office_occ(i))
                a1_psn_office(i).AppendChild(a1_psn_office_org(i))
                a1_psn_office(i).AppendChild(a1_psn_office_phone(i))
                a1_psn_office(i).AppendChild(a1_psn_office_fax(i))
                a1_psn_office(i).AppendChild(a1_psn_office_type(i))
                'a1_psn_office(i).AppendChild(a1_psn_office_desc(i))
                'contact----------------
                a1_psn(i).AppendChild(a1_psn_contact(i))
                'a1_psn_contact(i).AppendChild(a1_psn_contact_addr(i))
                a1_psn_contact(i).AppendChild(a1_psn_contact_phone(i))
                'a1_psn_contact(i).AppendChild(a1_psn_contact_fax(i))
                'iddoc----------------
                'a1_psn(i).AppendChild(a1_psn_iddoc(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_type(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_desc(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_no(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_by(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_date(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_expire(i))
                'psn==========End==================
            Next

            'tsc==========Begin==================
            parentNode.AppendChild(a1_tsc)
            a1_tsc.AppendChild(a1_tsc_date)
            a1_tsc.AppendChild(a1_tsc_type)
            'a1_tsc.AppendChild(a1_tsc_desc)

            'asset---------------- 
            a1_tsc.AppendChild(a1_tsc_asset)
            a1_tsc_asset.AppendChild(a1_tsc_asset_type)
            'a1_tsc_asset.AppendChild(a1_tsc_asset_desc)
            a1_tsc_asset.AppendChild(a1_tsc_asset_detail)
            a1_tsc_asset.AppendChild(a1_tsc_asset_amt)
            'acc-------------------   
            a1_tsc.AppendChild(a1_tsc_acc)
            a1_tsc_acc.AppendChild(a1_tsc_acc_accno)
            a1_tsc_acc.AppendChild(a1_tsc_acc_aname)

            'acc_name-------------------
            a1_tsc_acc.AppendChild(a1_tsc_acc_name)
            'a1_tsc_acc_name.AppendChild(a1_tsc_acc_name_prefix)
            a1_tsc_acc_name.AppendChild(a1_tsc_acc_name_first)
            'a1_tsc_acc_name.AppendChild(a1_tsc_acc_name_middle)
            a1_tsc_acc_name.AppendChild(a1_tsc_acc_name_last)

            'racc-------------------   
            a1_tsc.AppendChild(a1_tsc_racc)
            a1_tsc_racc.AppendChild(a1_tsc_racc_accno)
            a1_tsc_racc.AppendChild(a1_tsc_racc_aname)

            'racc_name-------------------
            a1_tsc_racc.AppendChild(a1_tsc_racc_name)
            'a1_tsc_racc_name.AppendChild(a1_tsc_racc_name_prefix)
            a1_tsc_racc_name.AppendChild(a1_tsc_racc_name_first)
            'a1_tsc_racc_name.AppendChild(a1_tsc_racc_name_middle)
            a1_tsc_racc_name.AppendChild(a1_tsc_racc_name_last)
            'racc_relation---------------- 
            a1_tsc_racc.AppendChild(a1_tsc_racc_relation)
            a1_tsc_racc_relation.AppendChild(a1_tsc_racc_relation_type)
            'a1_tsc_racc_relation.AppendChild(a1_tsc_racc_relation_desc)


            'name-------------------
            a1_tsc.AppendChild(a1_tsc_name)
            'a1_tsc_name.AppendChild(a1_tsc_name_prefix)
            a1_tsc_name.AppendChild(a1_tsc_name_first)
            'a1_tsc_name.AppendChild(a1_tsc_name_middle)
            a1_tsc_name.AppendChild(a1_tsc_name_last)
            'obj----------------
            a1_tsc.AppendChild(a1_tsc_obj)
            a1_tsc_obj.AppendChild(a1_tsc_obj_type)
            'a1_tsc_obj.AppendChild(a1_tsc_obj_desc)
            'tsc==========End==================
            'record==========Begin==================
            parentNode.AppendChild(a1_record)
            a1_record.AppendChild(a1_record_writer)
            a1_record.AppendChild(a1_record_sign)
            a1_record.AppendChild(a1_record_date)
            'record==========End==================

            '// save the value of the fields into the nodes 
            a1_type.AppendChild(xmla1_type)
            a1_reportid.AppendChild(xmla1_reportid)
            'a1_revision.AppendChild(xmla1_revision)
            a1_date.AppendChild(xmla1_date)
            'cnd==========Begin================== 
            'name-------------------
            'a1_cnd_name.AppendChild(xmla1_cnd_name)
            'a1_cnd_name_prefix.AppendChild(xmla1_cnd_name_prefix)
            a1_cnd_name_first.AppendChild(xmla1_cnd_name_first)
            'a1_cnd_name_middle.AppendChild(xmla1_cnd_name_middle)
            a1_cnd_name_last.AppendChild(xmla1_cnd_name_last)
            'id------------------------  
            a1_cnd_id_no.AppendChild(xmla1_cnd_id_no)
            a1_cnd_id_type.AppendChild(xmla1_cnd_id_type)
            'location----------------- 
            'a1_cnd_location_addr.AppendChild(xmla1_cnd_location_addr)
            a1_cnd_location_phone.AppendChild(xmla1_cnd_location_phone)
            'a1_cnd_location_fax.AppendChild(xmla1_cnd_location_fax)
            'office----------------- 
            a1_cnd_office_occ.AppendChild(xmla1_cnd_office_occ)
            'a1_cnd_office_desc.AppendChild(xmla1_cnd_office_desc)
            a1_cnd_office_org.AppendChild(xmla1_cnd_office_org)
            a1_cnd_office_phone.AppendChild(xmla1_cnd_office_phone)
            a1_cnd_office_fax.AppendChild(xmla1_cnd_office_fax)
            'contact---------------- 
            'a1_cnd_contact_addr.AppendChild(xmla1_cnd_contact_addr)
            a1_cnd_contact_phone.AppendChild(xmla1_cnd_contact_phone)
            'a1_cnd_contact_fax.AppendChild(xmla1_cnd_contact_fax)
            'iddoc---------------- 
            'a1_cnd_iddoc_type.AppendChild(xmla1_cnd_iddoc_type)
            'a1_cnd_iddoc_desc.AppendChild(xmla1_cnd_iddoc_desc)
            'a1_cnd_iddoc_no.AppendChild(xmla1_cnd_iddoc_no)
            'a1_cnd_iddoc_by.AppendChild(xmla1_cnd_iddoc_by)
            'a1_cnd_iddoc_date.AppendChild(xmla1_cnd_iddoc_date)
            'a1_cnd_iddoc_expire.AppendChild(xmla1_cnd_iddoc_expire)
            'cnd==========End==================
            For i = 1 To pCountPsn
                a1_psn_relation(i).AppendChild(xmla1_psn_relation(i))
                'name------------------- 
                'a1_psn_name_prefix(i).AppendChild(xmla1_psn_name_prefix(i))
                a1_psn_name_first(i).AppendChild(xmla1_psn_name_first(i))
                'a1_psn_name_middle(i).AppendChild(xmla1_psn_name_middle(i))
                a1_psn_name_last(i).AppendChild(xmla1_psn_name_last(i))
                'id------------------------ 
                a1_psn_id_no(i).AppendChild(xmla1_psn_id_no(i))
                a1_psn_id_type(i).AppendChild(xmla1_psn_id_type(i))
                'location----------------- 
                'a1_psn_location_addr(i).AppendChild(xmla1_psn_location_addr(i))
                a1_psn_location_phone(i).AppendChild(xmla1_psn_location_phone(i))
                'a1_psn_location_fax(i).AppendChild(xmla1_psn_location_fax(i))
                'office----------------- 
                a1_psn_office_occ(i).AppendChild(xmla1_psn_office_occ(i))
                a1_psn_office_org(i).AppendChild(xmla1_psn_office_org(i))
                a1_psn_office_phone(i).AppendChild(xmla1_psn_office_phone(i))
                a1_psn_office_fax(i).AppendChild(xmla1_psn_office_fax(i))
                a1_psn_office_type(i).AppendChild(xmla1_psn_office_type(i))
                'a1_psn_office_desc(i).AppendChild(xmla1_psn_office_desc(i))
                'contact---------------- 
                'a1_psn_contact_addr(i).AppendChild(xmla1_psn_contact_addr(i))
                a1_psn_contact_phone(i).AppendChild(xmla1_psn_contact_phone(i))
                'a1_psn_contact_fax(i).AppendChild(xmla1_psn_contact_fax(i))
                'iddoc---------------- 
                'a1_psn_iddoc_type(i).AppendChild(xmla1_psn_iddoc_type(i))
                'a1_psn_iddoc_desc(i).AppendChild(xmla1_psn_iddoc_desc(i))
                'a1_psn_iddoc_no(i).AppendChild(xmla1_psn_iddoc_no(i))
                'a1_psn_iddoc_by(i).AppendChild(xmla1_psn_iddoc_by(i))
                'a1_psn_iddoc_date(i).AppendChild(xmla1_psn_iddoc_date(i))
                'a1_psn_iddoc_expire(i).AppendChild(xmla1_psn_iddoc_expire(i))
                'psn==========End==================

            Next
            'psn==========Begin================== 

            'tsc==========Begin================== 
            a1_tsc_date.AppendChild(xmla1_tsc_date)
            a1_tsc_type.AppendChild(xmla1_tsc_type)
            'a1_tsc_desc.AppendChild(xmla1_tsc_desc)
            'asset---------------- 
            a1_tsc_asset_type.AppendChild(xmla1_tsc_asset_type)
            'a1_tsc_asset_desc.AppendChild(xmla1_tsc_asset_desc)
            a1_tsc_asset_detail.AppendChild(xmla1_tsc_asset_detail)
            a1_tsc_asset_amt.AppendChild(xmla1_tsc_asset_amt)
            'acc-------------------   
            a1_tsc_acc_accno.AppendChild(xmla1_tsc_acc_accno)
            a1_tsc_acc_aname.AppendChild(xmla1_tsc_acc_aname)
            'acc_name------------------- 
            'a1_tsc_acc_name_prefix.AppendChild(xmla1_tsc_acc_name_prefix)
            a1_tsc_acc_name_first.AppendChild(xmla1_tsc_acc_name_first)
            'a1_tsc_acc_name_middle.AppendChild(xmla1_tsc_acc_name_middle)
            a1_tsc_acc_name_last.AppendChild(xmla1_tsc_acc_name_last)
            'racc---------------- 
            a1_tsc_racc_accno.AppendChild(xmla1_tsc_racc_accno)
            a1_tsc_racc_aname.AppendChild(xmla1_tsc_racc_aname)
            'racc_name------------------- 
            'a1_tsc_racc_name_prefix.AppendChild(xmla1_tsc_racc_name_prefix)
            a1_tsc_racc_name_first.AppendChild(xmla1_tsc_racc_name_first)
            'a1_tsc_racc_name_middle.AppendChild(xmla1_tsc_racc_name_middle)
            a1_tsc_racc_name_last.AppendChild(xmla1_tsc_racc_name_last)
            'racc_relation---------------- 
            a1_tsc_racc_relation_type.AppendChild(xmla1_tsc_racc_relation_type)
            'a1_tsc_racc_relation_desc.AppendChild(xmla1_tsc_racc_relation_desc)
            'name------------------- 
            'a1_tsc_name_prefix.AppendChild(xmla1_tsc_name_prefix)
            a1_tsc_name_first.AppendChild(xmla1_tsc_name_first)
            'a1_tsc_name_middle.AppendChild(xmla1_tsc_name_middle)
            a1_tsc_name_last.AppendChild(xmla1_tsc_name_last)
            'obj---------------- 
            a1_tsc_obj_type.AppendChild(xmla1_tsc_obj_type)
            'a1_tsc_obj_desc.AppendChild(xmla1_tsc_obj_desc)
            'tsc==========End==================
            'record==========Begin================== 
            a1_record_writer.AppendChild(xmla1_record_writer)
            a1_record_sign.AppendChild(xmla1_record_sign)
            a1_record_date.AppendChild(xmla1_record_date)
            'record==========End==================

            '// Save to the XML file
            'xmldoc.Save(filePath)
            Dim ansiWriter As StreamWriter
            ansiWriter = New StreamWriter(filePath, False, Encoding.Default)
            xmldoc.Save(ansiWriter)

            ansiWriter.Close()


            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function

    Public Function AddAMLO3node(ByVal filePath As String, ByVal pAmlo3Data As clsAmlo3Data, ByVal pCountPsn As Integer, ByVal pAmlo3Psn() As clsAmlo3Psn, ByVal intLoop As Integer, ByVal intMaxLoop As Integer) As Boolean
        Try
            Dim i As Integer
            Dim xmldoc As XmlDocument
            xmldoc = New XmlDocument()
            xmldoc.Load(filePath)
            Dim parentNode As XmlElement
            parentNode = xmldoc.CreateElement("doc")
            Dim a0_version As XmlElement
            Dim a0_org As XmlElement
            Dim xmla0_version As XmlText
            Dim xmla0_org As XmlText
            clsDateFormat = New clsDateFormat

            If Not (IsDBNull(xmldoc.DocumentElement)) Then
                xmldoc.DocumentElement.PrependChild(parentNode)
                If (intLoop = intMaxLoop) Then
                    a0_org = xmldoc.CreateElement("org")
                    a0_version = xmldoc.CreateElement("version")

                    xmla0_org = xmldoc.CreateTextNode("ธนาคารอาคารสงเคราะห์")
                    xmla0_version = xmldoc.CreateTextNode("1.1")

                    xmldoc.DocumentElement.PrependChild(a0_org)
                    xmldoc.DocumentElement.PrependChild(a0_version)

                    a0_org.AppendChild(xmla0_org)
                    a0_version.AppendChild(xmla0_version)

                End If

            End If

            ' Create the required nodes 

            Dim a1_type As XmlElement
            Dim a1_reportid As XmlElement
            'Dim a1_revision As XmlElement
            Dim a1_date As XmlElement
            Dim a1_refer As XmlElement
            'cnd==========Begin==================
            Dim a1_cnd As XmlElement
            'name-------------------
            Dim a1_cnd_name As XmlElement
            'Dim a1_cnd_name_prefix As XmlElement
            Dim a1_cnd_name_first As XmlElement
            'Dim a1_cnd_name_middle As XmlElement
            Dim a1_cnd_name_last As XmlElement
            'id------------------------
            Dim a1_cnd_id As XmlElement
            Dim a1_cnd_id_no As XmlElement
            Dim a1_cnd_id_type As XmlElement
            'location-----------------
            Dim a1_cnd_location As XmlElement
            'Dim a1_cnd_location_addr As XmlElement
            Dim a1_cnd_location_phone As XmlElement
            'Dim a1_cnd_location_fax As XmlElement
            'office-----------------
            Dim a1_cnd_office As XmlElement
            Dim a1_cnd_office_occ As XmlElement
            'Dim a1_cnd_office_desc As XmlElement
            Dim a1_cnd_office_org As XmlElement
            Dim a1_cnd_office_phone As XmlElement
            Dim a1_cnd_office_fax As XmlElement
            'contact----------------
            Dim a1_cnd_contact As XmlElement
            'Dim a1_cnd_contact_addr As XmlElement
            Dim a1_cnd_contact_phone As XmlElement
            'Dim a1_cnd_contact_fax As XmlElement
            'iddoc----------------
            'Dim a1_cnd_iddoc As XmlElement
            'Dim a1_cnd_iddoc_type As XmlElement
            'Dim a1_cnd_iddoc_desc As XmlElement
            'Dim a1_cnd_iddoc_no As XmlElement
            'Dim a1_cnd_iddoc_by As XmlElement
            'Dim a1_cnd_iddoc_date As XmlElement
            'Dim a1_cnd_iddoc_expire As XmlElement
            'cnd==========End==================
            'psn==========Begin==================
            Dim a1_psn(pCountPsn) As XmlElement
            Dim a1_psn_relation(pCountPsn) As XmlElement
            'name-------------------
            Dim a1_psn_name(pCountPsn) As XmlElement
            'Dim a1_psn_name_prefix(pCountPsn) As XmlElement
            Dim a1_psn_name_first(pCountPsn) As XmlElement
            'Dim a1_psn_name_middle(pCountPsn) As XmlElement
            Dim a1_psn_name_last(pCountPsn) As XmlElement
            'id------------------------
            Dim a1_psn_id(pCountPsn) As XmlElement
            Dim a1_psn_id_no(pCountPsn) As XmlElement
            Dim a1_psn_id_type(pCountPsn) As XmlElement
            'location-----------------
            Dim a1_psn_location(pCountPsn) As XmlElement
            'Dim a1_psn_location_addr(pCountPsn) As XmlElement
            Dim a1_psn_location_phone(pCountPsn) As XmlElement
            'Dim a1_psn_location_fax(pCountPsn) As XmlElement
            'office-----------------
            Dim a1_psn_office(pCountPsn) As XmlElement
            Dim a1_psn_office_occ(pCountPsn) As XmlElement
            Dim a1_psn_office_org(pCountPsn) As XmlElement
            Dim a1_psn_office_phone(pCountPsn) As XmlElement
            Dim a1_psn_office_fax(pCountPsn) As XmlElement
            Dim a1_psn_office_type(pCountPsn) As XmlElement
            'Dim a1_psn_office_desc(pCountPsn) As XmlElement
            'contact----------------
            Dim a1_psn_contact(pCountPsn) As XmlElement
            'Dim a1_psn_contact_addr(pCountPsn) As XmlElement
            Dim a1_psn_contact_phone(pCountPsn) As XmlElement
            'Dim a1_psn_contact_fax(pCountPsn) As XmlElement
            'iddoc----------------
            'Dim a1_psn_iddoc(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_type(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_desc(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_no(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_by(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_date(pCountPsn) As XmlElement
            'Dim a1_psn_iddoc_expire(pCountPsn) As XmlElement
            'psn==========End==================

            'tsc==========Begin==================
            Dim a1_tsc As XmlElement
            Dim a1_tsc_date As XmlElement
            Dim a1_tsc_type As XmlElement
            'Dim a1_tsc_desc As XmlElement
            'Dim a1_tsc_cur As XmlElement
            Dim a1_tsc_amt As XmlElement


            'acc-------------------   
            Dim a1_tsc_acc As XmlElement
            Dim a1_tsc_acc_accno As XmlElement
            Dim a1_tsc_acc_aname As XmlElement
            'acc_name------------------- 
            Dim a1_tsc_acc_name As XmlElement
            'Dim a1_tsc_acc_name_prefix As XmlElement
            Dim a1_tsc_acc_name_first As XmlElement
            'Dim a1_tsc_acc_name_middle As XmlElement
            Dim a1_tsc_acc_name_last As XmlElement
            'racc---------------- 
            Dim a1_tsc_racc As XmlElement
            Dim a1_tsc_racc_accno As XmlElement
            Dim a1_tsc_racc_aname As XmlElement
            'racc_name------------------- 
            Dim a1_tsc_racc_name As XmlElement
            'Dim a1_tsc_racc_name_prefix As XmlElement
            Dim a1_tsc_racc_name_first As XmlElement
            'Dim a1_tsc_racc_name_middle As XmlElement
            Dim a1_tsc_racc_name_last As XmlElement
            'racc_relation---------------- 
            Dim a1_tsc_racc_relation As XmlElement
            Dim a1_tsc_racc_relation_type As XmlElement
            'Dim a1_tsc_racc_relation_desc As XmlElement
            'name------------------- 
            Dim a1_tsc_name As XmlElement
            'Dim a1_tsc_name_prefix As XmlElement
            Dim a1_tsc_name_first As XmlElement
            'Dim a1_tsc_name_middle As XmlElement
            Dim a1_tsc_name_last As XmlElement
            'obj------------------- 
            Dim a1_tsc_obj As XmlElement
            Dim a1_tsc_obj_type As XmlElement
            'Dim a1_tsc_obj_desc As XmlElement

            'tsc==========End==================
            'record==========Begin==================
            'Dim a1_record As XmlElement
            Dim a1_record_note As XmlElement
            'record==========End==================



            a1_type = xmldoc.CreateElement("type")
            a1_reportid = xmldoc.CreateElement("reportid")
            'a1_revision = xmldoc.CreateElement("revision")
            a1_date = xmldoc.CreateElement("date")
            a1_refer = xmldoc.CreateElement("refer")

            'cnd==========Begin==================
            a1_cnd = xmldoc.CreateElement("cnd")
            'name-------------------
            a1_cnd_name = xmldoc.CreateElement("name")
            'a1_cnd_name_prefix = xmldoc.CreateElement("prefix")
            a1_cnd_name_first = xmldoc.CreateElement("first")
            'a1_cnd_name_middle = xmldoc.CreateElement("middle")
            a1_cnd_name_last = xmldoc.CreateElement("last")
            'id------------------------
            a1_cnd_id = xmldoc.CreateElement("id")
            a1_cnd_id_no = xmldoc.CreateElement("no")
            a1_cnd_id_type = xmldoc.CreateElement("type")
            'location-----------------
            a1_cnd_location = xmldoc.CreateElement("location")
            'a1_cnd_location_addr = xmldoc.CreateElement("addr")
            a1_cnd_location_phone = xmldoc.CreateElement("phone")
            'a1_cnd_location_fax = xmldoc.CreateElement("fax")
            'office-----------------
            a1_cnd_office = xmldoc.CreateElement("office")
            a1_cnd_office_occ = xmldoc.CreateElement("occ")
            'a1_cnd_office_desc = xmldoc.CreateElement("desc")
            a1_cnd_office_org = xmldoc.CreateElement("org")
            a1_cnd_office_phone = xmldoc.CreateElement("phone")
            a1_cnd_office_fax = xmldoc.CreateElement("fax")
            'contact----------------
            a1_cnd_contact = xmldoc.CreateElement("contact")
            'a1_cnd_contact_addr = xmldoc.CreateElement("addr")
            a1_cnd_contact_phone = xmldoc.CreateElement("phone")
            'a1_cnd_contact_fax = xmldoc.CreateElement("fax")
            'iddoc----------------
            'a1_cnd_iddoc = xmldoc.CreateElement("iddoc")
            'a1_cnd_iddoc_type = xmldoc.CreateElement("type")
            'a1_cnd_iddoc_desc = xmldoc.CreateElement("desc")
            'a1_cnd_iddoc_no = xmldoc.CreateElement("no")
            'a1_cnd_iddoc_by = xmldoc.CreateElement("by")
            'a1_cnd_iddoc_date = xmldoc.CreateElement("date")
            'a1_cnd_iddoc_expire = xmldoc.CreateElement("expire")
            'cnd==========End==================

            For i = 1 To pCountPsn
                'psn==========Begin==================
                a1_psn(i) = xmldoc.CreateElement("psn")
                a1_psn_relation(i) = xmldoc.CreateElement("relation")
                'name-------------------
                a1_psn_name(i) = xmldoc.CreateElement("name")
                'a1_psn_name_prefix(i) = xmldoc.CreateElement("prefix")
                a1_psn_name_first(i) = xmldoc.CreateElement("first")
                'a1_psn_name_middle(i) = xmldoc.CreateElement("middle")
                a1_psn_name_last(i) = xmldoc.CreateElement("last")
                'id------------------------
                a1_psn_id(i) = xmldoc.CreateElement("id")
                a1_psn_id_no(i) = xmldoc.CreateElement("no")
                a1_psn_id_type(i) = xmldoc.CreateElement("type")
                'location-----------------
                a1_psn_location(i) = xmldoc.CreateElement("location")
                'a1_psn_location_addr(i) = xmldoc.CreateElement("addr")
                a1_psn_location_phone(i) = xmldoc.CreateElement("phone")
                'a1_psn_location_fax(i) = xmldoc.CreateElement("fax")
                'office-----------------
                a1_psn_office(i) = xmldoc.CreateElement("office")
                a1_psn_office_occ(i) = xmldoc.CreateElement("occ")
                a1_psn_office_org(i) = xmldoc.CreateElement("org")
                a1_psn_office_phone(i) = xmldoc.CreateElement("phone")
                a1_psn_office_fax(i) = xmldoc.CreateElement("fax")
                a1_psn_office_type(i) = xmldoc.CreateElement("type")
                'a1_psn_office_desc(i) = xmldoc.CreateElement("desc")
                'contact----------------
                a1_psn_contact(i) = xmldoc.CreateElement("contact")
                'a1_psn_contact_addr(i) = xmldoc.CreateElement("addr")
                a1_psn_contact_phone(i) = xmldoc.CreateElement("phone")
                'a1_psn_contact_fax(i) = xmldoc.CreateElement("fax")
                'iddoc----------------
                'a1_psn_iddoc(i) = xmldoc.CreateElement("iddoc")
                'a1_psn_iddoc_type(i) = xmldoc.CreateElement("type")
                'a1_psn_iddoc_desc(i) = xmldoc.CreateElement("desc")
                'a1_psn_iddoc_no(i) = xmldoc.CreateElement("no")
                'a1_psn_iddoc_by(i) = xmldoc.CreateElement("by")
                'a1_psn_iddoc_date(i) = xmldoc.CreateElement("date")
                'a1_psn_iddoc_expire(i) = xmldoc.CreateElement("expire")
                'psn==========End==================
            Next


            'tsc==========Begin==================
            a1_tsc = xmldoc.CreateElement("tsc")
            a1_tsc_date = xmldoc.CreateElement("date")
            a1_tsc_type = xmldoc.CreateElement("type")
            'a1_tsc_desc = xmldoc.CreateElement("desc")
            'a1_tsc_cur = xmldoc.CreateElement("cur")
            a1_tsc_amt = xmldoc.CreateElement("amt")
            'acc-------------------   
            a1_tsc_acc = xmldoc.CreateElement("acc")
            a1_tsc_acc_accno = xmldoc.CreateElement("accno")
            a1_tsc_acc_aname = xmldoc.CreateElement("aname")
            'acc_name------------------- 
            a1_tsc_acc_name = xmldoc.CreateElement("name")
            'a1_tsc_acc_name_prefix = xmldoc.CreateElement("prefix")
            a1_tsc_acc_name_first = xmldoc.CreateElement("first")
            'a1_tsc_acc_name_middle = xmldoc.CreateElement("middle")
            a1_tsc_acc_name_last = xmldoc.CreateElement("last")
            'racc---------------- 
            a1_tsc_racc = xmldoc.CreateElement("racc")
            a1_tsc_racc_accno = xmldoc.CreateElement("accno")
            a1_tsc_racc_aname = xmldoc.CreateElement("aname")
            'racc_name------------------- 
            a1_tsc_racc_name = xmldoc.CreateElement("name")
            'a1_tsc_racc_name_prefix = xmldoc.CreateElement("prefix")
            a1_tsc_racc_name_first = xmldoc.CreateElement("first")
            'a1_tsc_racc_name_middle = xmldoc.CreateElement("middle")
            a1_tsc_racc_name_last = xmldoc.CreateElement("last")
            'racc---------------- 
            a1_tsc_racc_relation = xmldoc.CreateElement("relation")
            a1_tsc_racc_relation_type = xmldoc.CreateElement("type")
            'a1_tsc_racc_relation_desc = xmldoc.CreateElement("desc")
            'name------------------- 
            a1_tsc_name = xmldoc.CreateElement("name")
            'a1_tsc_name_prefix = xmldoc.CreateElement("prefix")
            a1_tsc_name_first = xmldoc.CreateElement("first")
            'a1_tsc_name_middle = xmldoc.CreateElement("middle")
            a1_tsc_name_last = xmldoc.CreateElement("last")
            'obj------------------- 
            a1_tsc_obj = xmldoc.CreateElement("obj")
            a1_tsc_obj_type = xmldoc.CreateElement("type")
            'a1_tsc_obj_desc = xmldoc.CreateElement("desc")


            'tsc==========End==================
            'record==========Begin==================
            'a1_record = xmldoc.CreateElement("record")
            a1_record_note = xmldoc.CreateElement("note")

            'record==========End==================

            Dim xmla1_type As XmlText
            Dim xmla1_reportid As XmlText
            'Dim xmla1_revision As XmlText
            Dim xmla1_date As XmlText
            Dim xmla1_refer As XmlText

            'cnd==========Begin==================
            ' Dim xmla1_cnd As XmlText
            'name-------------------
            'Dim xmla1_cnd_name As XmlText
            'Dim xmla1_cnd_name_prefix As XmlText
            Dim xmla1_cnd_name_first As XmlText
            'Dim xmla1_cnd_name_middle As XmlText
            Dim xmla1_cnd_name_last As XmlText
            'id------------------------
            'Dim xmla1_cnd_id As XmlText
            Dim xmla1_cnd_id_no As XmlText
            Dim xmla1_cnd_id_type As XmlText
            'location-----------------
            'Dim xmla1_cnd_location As XmlText
            'Dim xmla1_cnd_location_addr As XmlText
            Dim xmla1_cnd_location_phone As XmlText
            'Dim xmla1_cnd_location_fax As XmlText
            'office-----------------
            'Dim xmla1_cnd_office As XmlText
            Dim xmla1_cnd_office_occ As XmlText
            'Dim xmla1_cnd_office_desc As XmlText
            Dim xmla1_cnd_office_org As XmlText
            Dim xmla1_cnd_office_phone As XmlText
            Dim xmla1_cnd_office_fax As XmlText
            'contact----------------
            'Dim xmla1_cnd_contact As XmlText
            'Dim xmla1_cnd_contact_addr As XmlText
            Dim xmla1_cnd_contact_phone As XmlText
            'Dim xmla1_cnd_contact_fax As XmlText
            'iddoc----------------
            'Dim xmla1_cnd_iddoc As XmlText
            'Dim xmla1_cnd_iddoc_type As XmlText
            'Dim xmla1_cnd_iddoc_desc As XmlText
            'Dim xmla1_cnd_iddoc_no As XmlText
            'Dim xmla1_cnd_iddoc_by As XmlText
            'Dim xmla1_cnd_iddoc_date As XmlText
            'Dim xmla1_cnd_iddoc_expire As XmlText
            'cnd==========End==================
            'psn==========Begin==================
            'Dim xmla1_psn As XmlText
            Dim xmla1_psn_relation(pCountPsn) As XmlText
            'name-------------------
            'Dim xmla1_psn_name As XmlText
            'Dim xmla1_psn_name_prefix(pCountPsn) As XmlText
            Dim xmla1_psn_name_first(pCountPsn) As XmlText
            'Dim xmla1_psn_name_middle(pCountPsn) As XmlText
            Dim xmla1_psn_name_last(pCountPsn) As XmlText
            'id------------------------
            'Dim xmla1_psn_id As XmlText
            Dim xmla1_psn_id_no(pCountPsn) As XmlText
            Dim xmla1_psn_id_type(pCountPsn) As XmlText
            'location-----------------
            'Dim xmla1_psn_location As XmlText
            'Dim xmla1_psn_location_addr(pCountPsn) As XmlText
            Dim xmla1_psn_location_phone(pCountPsn) As XmlText
            'Dim xmla1_psn_location_fax(pCountPsn) As XmlText
            'office-----------------
            'Dim xmla1_psn_office As XmlText
            Dim xmla1_psn_office_occ(pCountPsn) As XmlText
            Dim xmla1_psn_office_org(pCountPsn) As XmlText
            Dim xmla1_psn_office_phone(pCountPsn) As XmlText
            Dim xmla1_psn_office_fax(pCountPsn) As XmlText
            Dim xmla1_psn_office_type(pCountPsn) As XmlText
            'Dim xmla1_psn_office_desc(pCountPsn) As XmlText
            'contact----------------
            'Dim xmla1_psn_contact As XmlText
            'Dim xmla1_psn_contact_addr(pCountPsn) As XmlText
            Dim xmla1_psn_contact_phone(pCountPsn) As XmlText
            'Dim xmla1_psn_contact_fax(pCountPsn) As XmlText
            'iddoc----------------
            'Dim xmla1_psn_iddoc As XmlText
            'Dim xmla1_psn_iddoc_type(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_desc(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_no(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_by(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_date(pCountPsn) As XmlText
            'Dim xmla1_psn_iddoc_expire(pCountPsn) As XmlText
            'psn==========End==================

            'tsc==========Begin==================
            'Dim xmla1_tsc As XmlText
            Dim xmla1_tsc_date As XmlText
            Dim xmla1_tsc_type As XmlText
            'Dim xmla1_tsc_desc As XmlText
            'Dim xmla1_tsc_cur As XmlText
            Dim xmla1_tsc_amt As XmlText

            'acc-------------------   

            Dim xmla1_tsc_acc_accno As XmlText
            Dim xmla1_tsc_acc_aname As XmlText
            'acc_name------------------- 

            'Dim xmla1_tsc_acc_name_prefix As XmlText
            Dim xmla1_tsc_acc_name_first As XmlText
            'Dim xmla1_tsc_acc_name_middle As XmlText
            Dim xmla1_tsc_acc_name_last As XmlText

            'racc---------------- 

            Dim xmla1_tsc_racc_accno As XmlText
            Dim xmla1_tsc_racc_aname As XmlText
            'racc_name------------------- 

            'Dim xmla1_tsc_racc_name_prefix As XmlText
            Dim xmla1_tsc_racc_name_first As XmlText
            'Dim xmla1_tsc_racc_name_middle As XmlText
            Dim xmla1_tsc_racc_name_last As XmlText
            'racc_relation---------------- 

            Dim xmla1_tsc_racc_relation_type As XmlText
            'Dim xmla1_tsc_racc_relation_desc As XmlText
            'name-------------------
            'Dim xmla1_tsc_name As XmlText
            'Dim xmla1_tsc_name_prefix As XmlText
            Dim xmla1_tsc_name_first As XmlText
            'Dim xmla1_tsc_name_middle As XmlText
            Dim xmla1_tsc_name_last As XmlText
            'obj----------------
            'Dim xmla1_tsc_obj As XmlText
            Dim xmla1_tsc_obj_type As XmlText
            'Dim xmla1_tsc_obj_desc As XmlText
            'tsc==========End==================
            'record==========Begin==================
            'Dim xmla1_record As XmlText
            Dim xmla1_record_note As XmlText

            'record==========End==================

            xmla1_type = xmldoc.CreateTextNode(pAmlo3Data.p01_type)
            xmla1_reportid = xmldoc.CreateTextNode(pAmlo3Data.p02_reportid)
            'xmla1_revision = xmldoc.CreateTextNode(pAmlo3Data.p03_revision)
            xmla1_date = xmldoc.CreateTextNode(pAmlo3Data.p04_date)
            xmla1_refer = xmldoc.CreateTextNode(pAmlo3Data.p05_refer)

            'cnd==========Begin================== 
            'name------------------- 
            'xmla1_cnd_name_prefix = xmldoc.CreateTextNode(pAmlo3Data.p101_cnd_name_prefix)
            xmla1_cnd_name_first = xmldoc.CreateTextNode(pAmlo3Data.p102_cnd_name_first)
            'xmla1_cnd_name_middle = xmldoc.CreateTextNode(pAmlo3Data.p103_cnd_name_middle)
            xmla1_cnd_name_last = xmldoc.CreateTextNode(pAmlo3Data.p104_cnd_name_last)
            'id------------------------ 
            xmla1_cnd_id_no = xmldoc.CreateTextNode(pAmlo3Data.p105_cnd_id_no)
            xmla1_cnd_id_type = xmldoc.CreateTextNode(pAmlo3Data.p106_cnd_id_type)
            'location----------------- 
            'xmla1_cnd_location_addr = xmldoc.CreateTextNode(pAmlo3Data.p107_cnd_location_addr)
            xmla1_cnd_location_phone = xmldoc.CreateTextNode(pAmlo3Data.p108_cnd_location_phone)
            'xmla1_cnd_location_fax = xmldoc.CreateTextNode(pAmlo3Data.p109_cnd_location_fax)
            'office----------------- 
            xmla1_cnd_office_occ = xmldoc.CreateTextNode(pAmlo3Data.p110_cnd_office_occ)
            'xmla1_cnd_office_desc = xmldoc.CreateTextNode(pAmlo3Data.p111_cnd_office_desc)
            xmla1_cnd_office_org = xmldoc.CreateTextNode(pAmlo3Data.p112_cnd_office_org)
            xmla1_cnd_office_phone = xmldoc.CreateTextNode(pAmlo3Data.p113_cnd_office_phone)
            xmla1_cnd_office_fax = xmldoc.CreateTextNode(pAmlo3Data.p114_cnd_office_fax)
            'contact---------------- 
            'xmla1_cnd_contact_addr = xmldoc.CreateTextNode(pAmlo3Data.p115_cnd_contact_addr)
            xmla1_cnd_contact_phone = xmldoc.CreateTextNode(pAmlo3Data.p116_cnd_contact_phone)
            'xmla1_cnd_contact_fax = xmldoc.CreateTextNode(pAmlo3Data.p117_cnd_contact_fax)
            'iddoc---------------- 
            'xmla1_cnd_iddoc_type = xmldoc.CreateTextNode(pAmlo3Data.p118_cnd_iddoc_type)
            'xmla1_cnd_iddoc_desc = xmldoc.CreateTextNode(pAmlo3Data.p119_cnd_iddoc_desc)
            'xmla1_cnd_iddoc_no = xmldoc.CreateTextNode(pAmlo3Data.p120_cnd_iddoc_no)
            'xmla1_cnd_iddoc_by = xmldoc.CreateTextNode(pAmlo3Data.p121_cnd_iddoc_by)
            'xmla1_cnd_iddoc_date = xmldoc.CreateTextNode(pAmlo3Data.p122_cnd_iddoc_date)
            'xmla1_cnd_iddoc_expire = xmldoc.CreateTextNode(pAmlo3Data.p123_cnd_iddoc_expire)
            'cnd==========End==================
            For i = 1 To pCountPsn
                'psn==========Begin================== 
                xmla1_psn_relation(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p201_psn_relation)
                'name------------------- 
                'xmla1_psn_name_prefix(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p202_psn_name_prefix)
                xmla1_psn_name_first(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p203_psn_name_first)
                'xmla1_psn_name_middle(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p204_psn_name_middle)
                xmla1_psn_name_last(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p205_psn_name_last)
                'id------------------------ 
                xmla1_psn_id_no(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p206_psn_id_no)
                xmla1_psn_id_type(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p207_psn_id_type)
                'location----------------- 
                'xmla1_psn_location_addr(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p208_psn_location_addr)
                xmla1_psn_location_phone(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p209_psn_location_phone)
                'xmla1_psn_location_fax(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p210_psn_location_fax)
                'office----------------- 
                xmla1_psn_office_occ(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p211_psn_office_occ)
                xmla1_psn_office_org(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p212_psn_office_org)
                xmla1_psn_office_phone(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p213_psn_office_phone)
                xmla1_psn_office_fax(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p214_psn_office_fax)
                xmla1_psn_office_type(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p215_psn_office_type)
                'xmla1_psn_office_desc(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p216_psn_office_desc)
                'contact---------------- 
                'xmla1_psn_contact_addr(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p217_psn_contact_addr)
                xmla1_psn_contact_phone(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p218_psn_contact_phone)
                'xmla1_psn_contact_fax(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p219_psn_contact_fax)
                'iddoc---------------- 
                'xmla1_psn_iddoc_type(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p220_psn_iddoc_type)
                'xmla1_psn_iddoc_desc(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p221_psn_iddoc_desc)
                'xmla1_psn_iddoc_no(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p222_psn_iddoc_no)
                'xmla1_psn_iddoc_by(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p223_psn_iddoc_by)
                'xmla1_psn_iddoc_date(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p224_psn_iddoc_date)
                'xmla1_psn_iddoc_expire(i) = xmldoc.CreateTextNode(pAmlo3Psn(i).p225_psn_iddoc_expire)
                'psn==========End==================
            Next i
            'tsc==========Begin================== 
            xmla1_tsc_date = xmldoc.CreateTextNode(pAmlo3Data.p301_tsc_date)
            xmla1_tsc_type = xmldoc.CreateTextNode(pAmlo3Data.p302_tsc_type)
            'xmla1_tsc_desc = xmldoc.CreateTextNode(pAmlo3Data.p303_tsc_desc)
            'xmla1_tsc_cur = xmldoc.CreateTextNode(pAmlo3Data.p304_tsc_cur)
            xmla1_tsc_amt = xmldoc.CreateTextNode(pAmlo3Data.p305_tsc_amt)

            'acc-------------------    
            xmla1_tsc_acc_accno = xmldoc.CreateTextNode(pAmlo3Data.p306_tsc_acc_accno)
            xmla1_tsc_acc_aname = xmldoc.CreateTextNode(pAmlo3Data.p307_tsc_acc_aname)
            'acc_name-------------------  
            'xmla1_tsc_acc_name_prefix = xmldoc.CreateTextNode(pAmlo3Data.p308_tsc_acc_name_prefix)
            xmla1_tsc_acc_name_first = xmldoc.CreateTextNode(pAmlo3Data.p309_tsc_acc_name_first)
            'xmla1_tsc_acc_name_middle = xmldoc.CreateTextNode(pAmlo3Data.p310_tsc_acc_name_middle)
            xmla1_tsc_acc_name_last = xmldoc.CreateTextNode(pAmlo3Data.p311_tsc_acc_name_last)
            'racc----------------  
            xmla1_tsc_racc_accno = xmldoc.CreateTextNode(pAmlo3Data.p312_tsc_racc_accno)
            xmla1_tsc_racc_aname = xmldoc.CreateTextNode(pAmlo3Data.p313_tsc_racc_aname)
            'racc_name-------------------   
            'xmla1_tsc_racc_name_prefix = xmldoc.CreateTextNode(pAmlo3Data.p314_tsc_racc_name_prefix)
            xmla1_tsc_racc_name_first = xmldoc.CreateTextNode(pAmlo3Data.p315_tsc_racc_name_first)
            'xmla1_tsc_racc_name_middle = xmldoc.CreateTextNode(pAmlo3Data.p316_tsc_racc_name_middle)
            xmla1_tsc_racc_name_last = xmldoc.CreateTextNode(pAmlo3Data.p317_tsc_racc_name_last)
            'racc---------------- 
            xmla1_tsc_racc_relation_type = xmldoc.CreateTextNode(pAmlo3Data.p318_tsc_racc_relation_type)
            'xmla1_tsc_racc_relation_desc = xmldoc.CreateTextNode(pAmlo3Data.p319_tsc_racc_relation_desc)
            'name-------------------  
            'xmla1_tsc_name_prefix = xmldoc.CreateTextNode(pAmlo3Data.p320_tsc_name_prefix)
            xmla1_tsc_name_first = xmldoc.CreateTextNode(pAmlo3Data.p321_tsc_name_first)
            'xmla1_tsc_name_middle = xmldoc.CreateTextNode(pAmlo3Data.p322_tsc_name_middle)
            xmla1_tsc_name_last = xmldoc.CreateTextNode(pAmlo3Data.p323_tsc_name_last)

            'obj---------------- 
            xmla1_tsc_obj_type = xmldoc.CreateTextNode(pAmlo3Data.p324_tsc_obj_type)
            'xmla1_tsc_obj_desc = xmldoc.CreateTextNode(pAmlo3Data.p325_tsc_obj_desc)
            'tsc==========End==================
            'record==========Begin================== 
            xmla1_record_note = xmldoc.CreateTextNode(pAmlo3Data.p401_record_note)

            'record==========End==================

            '// append the nodes to the parentNode without the value
            parentNode.AppendChild(a1_type)
            parentNode.AppendChild(a1_reportid)
            'parentNode.AppendChild(a1_revision)
            parentNode.AppendChild(a1_date)
            parentNode.AppendChild(a1_refer)

            'cnd==========Begin==================
            parentNode.AppendChild(a1_cnd)
            'name-------------------
            a1_cnd.AppendChild(a1_cnd_name)
            'a1_cnd_name.AppendChild(a1_cnd_name_prefix)
            a1_cnd_name.AppendChild(a1_cnd_name_first)
            'a1_cnd_name.AppendChild(a1_cnd_name_middle)
            a1_cnd_name.AppendChild(a1_cnd_name_last)
            'id------------------------
            a1_cnd.AppendChild(a1_cnd_id)
            a1_cnd_id.AppendChild(a1_cnd_id_no)
            a1_cnd_id.AppendChild(a1_cnd_id_type)
            'location-----------------
            a1_cnd.AppendChild(a1_cnd_location)
            'a1_cnd_location.AppendChild(a1_cnd_location_addr)
            a1_cnd_location.AppendChild(a1_cnd_location_phone)
            'a1_cnd_location.AppendChild(a1_cnd_location_fax)
            'office-----------------
            a1_cnd.AppendChild(a1_cnd_office)
            a1_cnd_office.AppendChild(a1_cnd_office_occ)
            'a1_cnd_office.AppendChild(a1_cnd_office_desc)
            a1_cnd_office.AppendChild(a1_cnd_office_org)
            a1_cnd_office.AppendChild(a1_cnd_office_phone)
            a1_cnd_office.AppendChild(a1_cnd_office_fax)
            'contact----------------
            a1_cnd.AppendChild(a1_cnd_contact)
            'a1_cnd_contact.AppendChild(a1_cnd_contact_addr)
            a1_cnd_contact.AppendChild(a1_cnd_contact_phone)
            'a1_cnd_contact.AppendChild(a1_cnd_contact_fax)
            'iddoc----------------
            'a1_cnd.AppendChild(a1_cnd_iddoc)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_type)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_desc)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_no)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_by)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_date)
            'a1_cnd_iddoc.AppendChild(a1_cnd_iddoc_expire)
            'cnd==========End==================
            For i = 1 To pCountPsn
                'psn==========Begin==================
                parentNode.AppendChild(a1_psn(i))
                a1_psn(i).AppendChild(a1_psn_relation(i))
                'name-------------------
                a1_psn(i).AppendChild(a1_psn_name(i))
                'a1_psn_name(i).AppendChild(a1_psn_name_prefix(i))
                a1_psn_name(i).AppendChild(a1_psn_name_first(i))
                'a1_psn_name(i).AppendChild(a1_psn_name_middle(i))
                a1_psn_name(i).AppendChild(a1_psn_name_last(i))
                'id------------------------
                a1_psn(i).AppendChild(a1_psn_id(i))
                a1_psn_id(i).AppendChild(a1_psn_id_no(i))
                a1_psn_id(i).AppendChild(a1_psn_id_type(i))
                'location-----------------
                a1_psn(i).AppendChild(a1_psn_location(i))
                'a1_psn_location(i).AppendChild(a1_psn_location_addr(i))
                a1_psn_location(i).AppendChild(a1_psn_location_phone(i))
                'a1_psn_location(i).AppendChild(a1_psn_location_fax(i))
                'office-----------------
                a1_psn(i).AppendChild(a1_psn_office(i))
                a1_psn_office(i).AppendChild(a1_psn_office_occ(i))
                a1_psn_office(i).AppendChild(a1_psn_office_org(i))
                a1_psn_office(i).AppendChild(a1_psn_office_phone(i))
                a1_psn_office(i).AppendChild(a1_psn_office_fax(i))
                a1_psn_office(i).AppendChild(a1_psn_office_type(i))
                'a1_psn_office(i).AppendChild(a1_psn_office_desc(i))
                'contact----------------
                a1_psn(i).AppendChild(a1_psn_contact(i))
                'a1_psn_contact(i).AppendChild(a1_psn_contact_addr(i))
                a1_psn_contact(i).AppendChild(a1_psn_contact_phone(i))
                'a1_psn_contact(i).AppendChild(a1_psn_contact_fax(i))
                'iddoc----------------
                'a1_psn(i).AppendChild(a1_psn_iddoc(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_type(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_desc(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_no(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_by(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_date(i))
                'a1_psn_iddoc(i).AppendChild(a1_psn_iddoc_expire(i))
                'psn==========End==================

            Next

            'tsc==========Begin==================
            parentNode.AppendChild(a1_tsc)
            a1_tsc.AppendChild(a1_tsc_date)
            a1_tsc.AppendChild(a1_tsc_type)
            a1_tsc.AppendChild(a1_tsc_amt)

            'acc-------------------   
            a1_tsc.AppendChild(a1_tsc_acc)
            a1_tsc_acc.AppendChild(a1_tsc_acc_accno)
            a1_tsc_acc.AppendChild(a1_tsc_acc_aname)

            'acc_name-------------------
            a1_tsc_acc.AppendChild(a1_tsc_acc_name)
            'a1_tsc_acc_name.AppendChild(a1_tsc_acc_name_prefix)
            a1_tsc_acc_name.AppendChild(a1_tsc_acc_name_first)
            'a1_tsc_acc_name.AppendChild(a1_tsc_acc_name_middle)
            a1_tsc_acc_name.AppendChild(a1_tsc_acc_name_last)

            'racc-------------------   
            a1_tsc.AppendChild(a1_tsc_racc)
            a1_tsc_racc.AppendChild(a1_tsc_racc_accno)
            a1_tsc_racc.AppendChild(a1_tsc_racc_aname)

            'racc_name-------------------
            a1_tsc_racc.AppendChild(a1_tsc_racc_name)
            'a1_tsc_racc_name.AppendChild(a1_tsc_racc_name_prefix)
            a1_tsc_racc_name.AppendChild(a1_tsc_racc_name_first)
            'a1_tsc_racc_name.AppendChild(a1_tsc_racc_name_middle)
            a1_tsc_racc_name.AppendChild(a1_tsc_racc_name_last)
            'racc_relation---------------- 
            a1_tsc_racc.AppendChild(a1_tsc_racc_relation)
            a1_tsc_racc_relation.AppendChild(a1_tsc_racc_relation_type)
            'a1_tsc_racc_relation.AppendChild(a1_tsc_racc_relation_desc)


            'name-------------------
            a1_tsc.AppendChild(a1_tsc_name)
            'a1_tsc_name.AppendChild(a1_tsc_name_prefix)
            a1_tsc_name.AppendChild(a1_tsc_name_first)
            'a1_tsc_name.AppendChild(a1_tsc_name_middle)
            a1_tsc_name.AppendChild(a1_tsc_name_last)
            'obj----------------
            a1_tsc.AppendChild(a1_tsc_obj)
            a1_tsc_obj.AppendChild(a1_tsc_obj_type)
            'a1_tsc_obj.AppendChild(a1_tsc_obj_desc)
            'tsc==========End==================
            'record==========Begin==================
            'parentNode.AppendChild(a1_record)
            parentNode.AppendChild(a1_record_note)

            'record==========End==================

            '// save the value of the fields into the nodes 
            a1_type.AppendChild(xmla1_type)
            a1_reportid.AppendChild(xmla1_reportid)
            'a1_revision.AppendChild(xmla1_revision)
            a1_date.AppendChild(xmla1_date)
            a1_refer.AppendChild(xmla1_refer)
            'cnd==========Begin================== 
            'name-------------------
            'a1_cnd_name.AppendChild(xmla1_cnd_name)
            'a1_cnd_name_prefix.AppendChild(xmla1_cnd_name_prefix)
            a1_cnd_name_first.AppendChild(xmla1_cnd_name_first)
            'a1_cnd_name_middle.AppendChild(xmla1_cnd_name_middle)
            a1_cnd_name_last.AppendChild(xmla1_cnd_name_last)
            'id------------------------  
            a1_cnd_id_no.AppendChild(xmla1_cnd_id_no)
            a1_cnd_id_type.AppendChild(xmla1_cnd_id_type)
            'location----------------- 
            'a1_cnd_location_addr.AppendChild(xmla1_cnd_location_addr)
            a1_cnd_location_phone.AppendChild(xmla1_cnd_location_phone)
            'a1_cnd_location_fax.AppendChild(xmla1_cnd_location_fax)
            'office----------------- 
            a1_cnd_office_occ.AppendChild(xmla1_cnd_office_occ)
            'a1_cnd_office_desc.AppendChild(xmla1_cnd_office_desc)
            a1_cnd_office_org.AppendChild(xmla1_cnd_office_org)
            a1_cnd_office_phone.AppendChild(xmla1_cnd_office_phone)
            a1_cnd_office_fax.AppendChild(xmla1_cnd_office_fax)
            'contact---------------- 
            'a1_cnd_contact_addr.AppendChild(xmla1_cnd_contact_addr)
            a1_cnd_contact_phone.AppendChild(xmla1_cnd_contact_phone)
            'a1_cnd_contact_fax.AppendChild(xmla1_cnd_contact_fax)
            'iddoc---------------- 
            'a1_cnd_iddoc_type.AppendChild(xmla1_cnd_iddoc_type)
            'a1_cnd_iddoc_desc.AppendChild(xmla1_cnd_iddoc_desc)
            'a1_cnd_iddoc_no.AppendChild(xmla1_cnd_iddoc_no)
            'a1_cnd_iddoc_by.AppendChild(xmla1_cnd_iddoc_by)
            'a1_cnd_iddoc_date.AppendChild(xmla1_cnd_iddoc_date)
            'a1_cnd_iddoc_expire.AppendChild(xmla1_cnd_iddoc_expire)
            'cnd==========End==================
            For i = 1 To pCountPsn
                a1_psn_relation(i).AppendChild(xmla1_psn_relation(i))
                'name------------------- 
                'a1_psn_name_prefix(i).AppendChild(xmla1_psn_name_prefix(i))
                a1_psn_name_first(i).AppendChild(xmla1_psn_name_first(i))
                'a1_psn_name_middle(i).AppendChild(xmla1_psn_name_middle(i))
                a1_psn_name_last(i).AppendChild(xmla1_psn_name_last(i))
                'id------------------------ 
                a1_psn_id_no(i).AppendChild(xmla1_psn_id_no(i))
                a1_psn_id_type(i).AppendChild(xmla1_psn_id_type(i))
                'location----------------- 
                'a1_psn_location_addr(i).AppendChild(xmla1_psn_location_addr(i))
                a1_psn_location_phone(i).AppendChild(xmla1_psn_location_phone(i))
                'a1_psn_location_fax(i).AppendChild(xmla1_psn_location_fax(i))
                'office----------------- 
                a1_psn_office_occ(i).AppendChild(xmla1_psn_office_occ(i))
                a1_psn_office_org(i).AppendChild(xmla1_psn_office_org(i))
                a1_psn_office_phone(i).AppendChild(xmla1_psn_office_phone(i))
                a1_psn_office_fax(i).AppendChild(xmla1_psn_office_fax(i))
                a1_psn_office_type(i).AppendChild(xmla1_psn_office_type(i))
                'a1_psn_office_desc(i).AppendChild(xmla1_psn_office_desc(i))
                'contact---------------- 
                'a1_psn_contact_addr(i).AppendChild(xmla1_psn_contact_addr(i))
                a1_psn_contact_phone(i).AppendChild(xmla1_psn_contact_phone(i))
                'a1_psn_contact_fax(i).AppendChild(xmla1_psn_contact_fax(i))
                'iddoc---------------- 
                'a1_psn_iddoc_type(i).AppendChild(xmla1_psn_iddoc_type(i))
                'a1_psn_iddoc_desc(i).AppendChild(xmla1_psn_iddoc_desc(i))
                'a1_psn_iddoc_no(i).AppendChild(xmla1_psn_iddoc_no(i))
                'a1_psn_iddoc_by(i).AppendChild(xmla1_psn_iddoc_by(i))
                'a1_psn_iddoc_date(i).AppendChild(xmla1_psn_iddoc_date(i))
                'a1_psn_iddoc_expire(i).AppendChild(xmla1_psn_iddoc_expire(i))
                'psn==========End==================

            Next
            'psn==========Begin================== 

            'tsc==========Begin================== 
            a1_tsc_date.AppendChild(xmla1_tsc_date)
            a1_tsc_type.AppendChild(xmla1_tsc_type)
            a1_tsc_amt.AppendChild(xmla1_tsc_amt)

            'acc-------------------   
            a1_tsc_acc_accno.AppendChild(xmla1_tsc_acc_accno)
            a1_tsc_acc_aname.AppendChild(xmla1_tsc_acc_aname)
            'acc_name------------------- 
            'a1_tsc_acc_name_prefix.AppendChild(xmla1_tsc_acc_name_prefix)
            a1_tsc_acc_name_first.AppendChild(xmla1_tsc_acc_name_first)
            'a1_tsc_acc_name_middle.AppendChild(xmla1_tsc_acc_name_middle)
            a1_tsc_acc_name_last.AppendChild(xmla1_tsc_acc_name_last)
            'racc---------------- 
            a1_tsc_racc_accno.AppendChild(xmla1_tsc_racc_accno)
            a1_tsc_racc_aname.AppendChild(xmla1_tsc_racc_aname)
            'racc_name------------------- 
            'a1_tsc_racc_name_prefix.AppendChild(xmla1_tsc_racc_name_prefix)
            a1_tsc_racc_name_first.AppendChild(xmla1_tsc_racc_name_first)
            'a1_tsc_racc_name_middle.AppendChild(xmla1_tsc_racc_name_middle)
            a1_tsc_racc_name_last.AppendChild(xmla1_tsc_racc_name_last)
            'racc_relation---------------- 
            a1_tsc_racc_relation_type.AppendChild(xmla1_tsc_racc_relation_type)
            'a1_tsc_racc_relation_desc.AppendChild(xmla1_tsc_racc_relation_desc)
            'name------------------- 
            'a1_tsc_name_prefix.AppendChild(xmla1_tsc_name_prefix)
            a1_tsc_name_first.AppendChild(xmla1_tsc_name_first)
            'a1_tsc_name_middle.AppendChild(xmla1_tsc_name_middle)
            a1_tsc_name_last.AppendChild(xmla1_tsc_name_last)
            'obj---------------- 
            a1_tsc_obj_type.AppendChild(xmla1_tsc_obj_type)
            'a1_tsc_obj_desc.AppendChild(xmla1_tsc_obj_desc)
            'tsc==========End==================
            'record==========Begin================== 
            a1_record_note.AppendChild(xmla1_record_note)
            'record==========End==================

            '// Save to the XML file
            'xmldoc.Save(filePath)
            Dim ansiWriter As StreamWriter
            ansiWriter = New StreamWriter(filePath, False, Encoding.Default)
            xmldoc.Save(ansiWriter)
            ansiWriter.Close()

            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function


End Class
